From 864413f39c32ca5134d73995826743d1f09df361 Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Thu, 7 Jul 2022 17:57:41 +0200 Subject: [PATCH 01/51] Update VS insertion target --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index cbcc657f839..01abb29a8a0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -591,7 +591,7 @@ stages: - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - template: eng/release/insert-into-vs.yml parameters: - componentBranchName: refs/heads/release/dev17.3 + componentBranchName: refs/heads/release/dev17.4 insertTargetBranch: main insertTeamEmail: fsharpteam@microsoft.com insertTeamName: 'F#' From ff7d17b4153b35b768c3381d8455419d7f75dc18 Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Fri, 8 Jul 2022 09:49:51 -0700 Subject: [PATCH 02/51] Merge main to release/dev17.4 (#13472) Co-authored-by: Petr Pokorny Co-authored-by: Kevin Ransom (msft) Co-authored-by: 0101 <0101@innit.cz> Co-authored-by: Petr Semkin --- src/Compiler/CodeGen/IlxGen.fs | 26 +++- src/Compiler/FSComp.txt | 14 -- src/Compiler/TypedTree/TypedTreeOps.fsi | 3 + .../EmittedIL/Misc/Structs02.fs.il.debug.bsl | 1 + .../Misc/Structs02.fs.il.release.bsl | 1 + .../EmittedIL/StructGettersReadOnly.fs | 130 ++++++++++++++++++ .../FloatsAndDoubles.fs.il.debug.bsl | 2 + .../FloatsAndDoubles.fs.il.release.bsl | 2 + .../FSharp.Compiler.ComponentTests.fsproj | 2 + tests/FSharp.Test.Utilities/Compiler.fs | 27 ++-- .../FSharp.Test.Utilities.fsproj | 1 + .../FSharp.Test.Utilities/ReflectionHelper.fs | 63 +++++++++ .../Tests.ProjectSystem.References.fs | 85 ------------ 13 files changed, 243 insertions(+), 114 deletions(-) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/StructGettersReadOnly.fs create mode 100644 tests/FSharp.Test.Utilities/ReflectionHelper.fs diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index c6b672815cf..d2e3de58128 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -68,7 +68,7 @@ let iLdcDouble i = AI_ldc(DT_R8, ILConst.R8 i) let iLdcSingle i = AI_ldc(DT_R4, ILConst.R4 i) /// Make a method that simply loads a field -let mkLdfldMethodDef (ilMethName, reprAccess, isStatic, ilTy, ilFieldName, ilPropType) = +let mkLdfldMethodDef (ilMethName, reprAccess, isStatic, ilTy, ilFieldName, ilPropType, customAttrs) = let ilFieldSpec = mkILFieldSpecInTy (ilTy, ilFieldName, ilPropType) let ilReturn = mkILReturn ilPropType @@ -84,7 +84,7 @@ let mkLdfldMethodDef (ilMethName, reprAccess, isStatic, ilTy, ilFieldName, ilPro mkILNonGenericInstanceMethod (ilMethName, reprAccess, [], ilReturn, body) - ilMethodDef.WithSpecialName + ilMethodDef.With(customAttrs = mkILCustomAttrs customAttrs).WithSpecialName /// Choose the constructor parameter names for fields let ChooseParamNames fieldNamesAndTypes = @@ -600,11 +600,14 @@ type PtrsOK = | PtrTypesOK | PtrTypesNotOK +let GenReadOnlyAttribute (g: TcGlobals) = + mkILCustomAttribute (g.attrib_IsReadOnlyAttribute.TypeRef, [], [], []) + let GenReadOnlyAttributeIfNecessary (g: TcGlobals) ty = let add = isInByrefTy g ty && g.attrib_IsReadOnlyAttribute.TyconRef.CanDeref if add then - let attr = mkILCustomAttribute (g.attrib_IsReadOnlyAttribute.TypeRef, [], [], []) + let attr = GenReadOnlyAttribute g Some attr else None @@ -2094,7 +2097,8 @@ type AssemblyBuilder(cenv: cenv, anonTypeTable: AnonTypeGenerationTable) as mgbu let ilMethods = [ for propName, fldName, fldTy in flds -> - mkLdfldMethodDef ("get_" + propName, ILMemberAccess.Public, false, ilTy, fldName, fldTy) + let attrs = if isStruct then [ GenReadOnlyAttribute g ] else [] + mkLdfldMethodDef ("get_" + propName, ILMemberAccess.Public, false, ilTy, fldName, fldTy, attrs) yield! genToStringMethod ilTy ] @@ -9106,7 +9110,7 @@ and GenMethodForBinding // Check if we're compiling the property as a .NET event assert not (CompileAsEvent cenv.g v.Attribs) - // Emit the property, but not if its a private method impl + // Emit the property, but not if it's a private method impl if mdef.Access <> ILMemberAccess.Private then let vtyp = ReturnTypeOfPropertyVal g v let ilPropTy = GenType cenv m eenvUnderMethTypeTypars.tyenv vtyp @@ -10701,7 +10705,15 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = let ilPropName = fspec.LogicalName let ilMethName = "get_" + ilPropName let access = ComputeMemberAccess isPropHidden - yield mkLdfldMethodDef (ilMethName, access, isStatic, ilThisTy, ilFieldName, ilPropType) + let isStruct = isStructTyconRef tcref + + let attrs = + if isStruct && not isStatic then + [ GenReadOnlyAttribute g ] + else + [] + + yield mkLdfldMethodDef (ilMethName, access, isStatic, ilThisTy, ilFieldName, ilPropType, attrs) // Generate property setter methods for the mutable fields for useGenuineField, ilFieldName, isFSharpMutable, isStatic, _, ilPropType, isPropHidden, fspec in fieldSummaries do @@ -11225,7 +11237,7 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) = let ilFieldName = ComputeFieldName exnc fld let ilMethodDef = - mkLdfldMethodDef (ilMethName, reprAccess, false, ilThisTy, ilFieldName, ilPropType) + mkLdfldMethodDef (ilMethName, reprAccess, false, ilThisTy, ilFieldName, ilPropType, []) let ilFieldDef = mkILInstanceField (ilFieldName, ilPropType, None, ILMemberAccess.Assembly) diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index 6bbd661d7cf..a6ce206cc8f 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -270,7 +270,6 @@ chkUnionCaseDefaultAugmentation,"default augmentation of the union case" 435,chkGetterSetterDoNotMatchAbstract,"The property '%s' of type '%s' has a getter and a setter that do not match. If one is abstract then the other must be as well." 436,chkPropertySameNameIndexer,"The property '%s' has the same name as another property in type '%s', but one takes indexer arguments and the other does not. You may be missing an indexer argument to one of your properties." 437,chkCantStoreByrefValue,"A type would store a byref typed value. This is not permitted by Common IL." -#See related 1205 chkDuplicateInherittedVirtualMethod 438,chkDuplicateMethod,"Duplicate method. The method '%s' has the same name and signature as another method in type '%s'." 438,chkDuplicateMethodWithSuffix,"Duplicate method. The method '%s' has the same name and signature as another method in type '%s' once tuples, functions, units of measure and/or provided types are erased." 439,chkDuplicateMethodCurried,"The method '%s' has curried arguments but has the same name as another method in type '%s'. Methods with curried arguments cannot be overloaded. Consider using a method taking tupled arguments." @@ -474,7 +473,6 @@ parsSyntaxModuleStructEndDeprecated,"The syntax 'module ... = struct .. end' is parsSyntaxModuleSigEndDeprecated,"The syntax 'module ... : sig .. end' is not used in F# code. Consider using 'module ... = begin .. end'" 627,tcStaticFieldUsedWhenInstanceFieldExpected,"A static field was used where an instance field is expected" 629,tcMethodNotAccessible,"Method '%s' is not accessible from this code location" -#630,tcTypeFunctionFieldsCannotBeMutated,"Fields which are type functions cannot be mutated" 632,tcImplicitMeasureFollowingSlash,"Implicit product of measures following /" 633,tcUnexpectedMeasureAnon,"Unexpected SynMeasure.Anon" 634,tcNonZeroConstantCannotHaveGenericUnit,"Non-zero constants cannot have generic units. For generic zero, write 0.0<_>." @@ -647,8 +645,6 @@ tcExpressionWithIfRequiresParenthesis,"This list or array expression includes an 799,tcInvalidAssignment,"Invalid assignment" 800,tcInvalidUseOfTypeName,"Invalid use of a type name" 801,tcTypeHasNoAccessibleConstructor,"This type has no accessible object constructors" -#802,tcInvalidUseOfTypeNameOrConstructor,"Invalid use of a type name and/or object constructor. If necessary use 'new' and apply the constructor to its arguments, e.g. 'new Type(args)'." -#803,tcInvalidUseOfTypeNameOrConstructorWithOverloads,"Invalid use of a type name and/or object constructor. If necessary use 'new' and apply the constructor to its arguments, e.g. 'new Type(args)'. The required signature is:\n\t%s." 804,tcInvalidUseOfInterfaceType,"Invalid use of an interface type" 805,tcInvalidUseOfDelegate,"Invalid use of a delegate constructor. Use the syntax 'new Type(args)' or just 'Type(args)'." 806,tcPropertyIsNotStatic,"Property '%s' is not static" @@ -765,7 +761,6 @@ tcTypeOrModule,"type or module" 919,tcExceptionAbbreviationsMustReferToValidExceptions,"Exception abbreviations must refer to existing exceptions or F# types deriving from System.Exception" 920,tcAbbreviationsFordotNetExceptionsMustHaveMatchingObjectConstructor,"Abbreviations for Common IL exception types must have a matching object constructor" 921,tcNotAnException,"Not an exception" -#922,tcUnexpectedConstraintsOrParametersOnModule,"Unexpected constraints or parameters on module specification" 924,tcInvalidModuleName,"Invalid module name" 925,tcInvalidTypeExtension,"Invalid type extension" 926,tcAttributesOfTypeSpecifyMultipleKindsForType,"The attributes of this type specify multiple kinds for the type" @@ -798,7 +793,6 @@ tcTypeAbbreviationHasTypeParametersMissingOnType,"This type abbreviation has one 949,tcInvalidDelegateSpecification,"Delegate specifications must be of the form 'typ -> typ'" 950,tcDelegatesCannotBeCurried,"Delegate specifications must not be curried types. Use 'typ * ... * typ -> typ' for multi-argument delegates, and 'typ -> (typ -> typ)' for delegates returning function values." 951,tcInvalidTypeForLiteralEnumeration,"Literal enumerations must have type int, uint, int16, uint16, int64, uint64, byte, sbyte or char" -#952,tcTypeAbbreviationMustBePublic,"Type abbreviations must be public. If you want to use a private type abbreviation you must use an explicit signature." 953,tcTypeDefinitionIsCyclic,"This type definition involves an immediate cyclic reference through an abbreviation" 954,tcTypeDefinitionIsCyclicThroughInheritance,"This type definition involves an immediate cyclic reference through a struct field or inheritance relation" tcReservedSyntaxForAugmentation,"The syntax 'type X with ...' is reserved for augmentations. Types whose representations are hidden but which have members are now declared in signatures using 'type X = ...'. You may also need to add the '[] attribute to the type definition in the signature" @@ -813,8 +807,6 @@ tcReservedSyntaxForAugmentation,"The syntax 'type X with ...' is reserved for au 965,tcModuleAbbreviationForNamespace,"The path '%s' is a namespace. A module abbreviation may not abbreviate a namespace." 966,tcTypeUsedInInvalidWay,"The type '%s' is used in an invalid way. A value prior to '%s' has an inferred type involving '%s', which is an invalid forward reference." 967,tcMemberUsedInInvalidWay,"The member '%s' is used in an invalid way. A use of '%s' has been inferred prior to the definition of '%s', which is an invalid forward reference." -#968,tcExplicitSignaturesInImplementationFileCannotBeUsed,"Explicit signatures within implementation files are not permitted" -#969,tcModulesCannotUseNamedModuleSignatures,"Modules cannot use named module signature definitions" 970,tcAttributeAutoOpenWasIgnored,"The attribute 'AutoOpen(\"%s\")' in the assembly '%s' did not refer to a valid module or namespace in that assembly and has been ignored" 971,ilUndefinedValue,"Undefined value '%s'" 972,ilLabelNotFound,"Label %s not found" @@ -1069,8 +1061,6 @@ lexHashBangMustBeFirstInFile,"#! may only appear as the first line at the start 1189,parsNonAdjacentTypars,"Remove spaces between the type name and type parameter, e.g. \"type C<'T>\", not type \"C <'T>\". Type parameters must be placed directly adjacent to the type name." 1190,parsNonAdjacentTyargs,"Remove spaces between the type name and type parameter, e.g. \"C<'T>\", not \"C <'T>\". Type parameters must be placed directly adjacent to the type name." parsNonAtomicType,"The use of the type syntax 'int C' and 'C ' is not permitted here. Consider adjusting this type to be written in the form 'C'" -# 1191,tastUndefinedTyconItemField,"The type %s did not contain the field '%s'" -# 1192,tastUndefinedTyconItemUnionCase,"The type %s did not contain the union case '%s'" 1193,tastUndefinedItemRefModuleNamespace,"The module/namespace '%s' from compilation unit '%s' did not contain the module/namespace '%s'" 1194,tastUndefinedItemRefVal,"The module/namespace '%s' from compilation unit '%s' did not contain the val '%s'" 1195,tastUndefinedItemRefModuleNamespaceType,"The module/namespace '%s' from compilation unit '%s' did not contain the namespace, module or type '%s'" @@ -1090,7 +1080,6 @@ mlCompatSigColonNoLongerSupported,"The use of 'module M: sig ... end ' was depre mlCompatSigEndNoLongerSupported,"The use of 'module M = sig ... end ' was deprecated in F# 2.0 and is no longer supported. Remove the 'sig' and 'end' and use indentation instead" mlCompatMultiPrefixTyparsNoLongerSupported,"The use of multiple parenthesized type parameters before a generic type name such as '(int, int) Map' was deprecated in F# 2.0 and is no longer supported" mlCompatStructEndNoLongerSupported,"The use of 'module M = struct ... end ' was deprecated in F# 2.0 and is no longer supported. Remove the 'struct' and 'end' and use indentation instead" -#1205,chkDuplicateInherittedVirtualMethod,"Duplicate virtual methods. There are multiple virtual methods named '%s' with the same signature in the parent (inherited) type. This may be a result of instantiating the parent type." 1206,ilFieldDoesNotHaveValidOffsetForStructureLayout,"The type '%s' has been marked as having an Explicit layout, but the field '%s' has not been marked with the 'FieldOffset' attribute" 1207,tcInterfacesShouldUseInheritNotInterface,"Interfaces inherited by other interfaces should be declared using 'inherit ...' instead of 'interface ...'" 1208,parsInvalidPrefixOperator,"Invalid prefix operator" @@ -1103,7 +1092,6 @@ lexIfOCaml,"IF-FSHARP/IF-CAML regions are no longer supported" 1211,ilFieldHasOffsetForSequentialLayout,"The FieldOffset attribute can only be placed on members of types marked with the StructLayout(LayoutKind.Explicit)" 1212,tcOptionalArgsMustComeAfterNonOptionalArgs,"Optional arguments must come at the end of the argument list, after any non-optional arguments" 1213,tcConditionalAttributeUsage,"Attribute 'System.Diagnostics.ConditionalAttribute' is only valid on methods or attribute classes" -#1214,monoRegistryBugWorkaround,"Could not determine highest installed .NET framework version from Registry keys, using version 2.0" 1215,tcMemberOperatorDefinitionInExtrinsic,"Extension members cannot provide operator overloads. Consider defining the operator as part of the type definition instead." 1216,ilwriteMDBFileNameCannotBeChangedWarning,"The name of the MDB file must be .mdb. The --pdb option will be ignored." 1217,ilwriteMDBMemberMissing,"MDB generation failed. Could not find compatible member %s" @@ -1215,7 +1203,6 @@ fscTooManyErrors,"Exiting - too many errors" 3049,etProviderHasDesignerAssemblyException,"The type provider designer assembly '%s' could not be loaded from folder '%s'. The exception reported was: %s - %s" invalidNamespaceForProvidedType,"invalid namespace for provided type" invalidFullNameForProvidedType,"invalid full name for provided type" -#3050,etGenerateAttributeRequiresInternal,"The 'Generate' attribute must be used with a type definition with 'internal' visibility" 3051,etProviderReturnedNull,"The type provider returned 'null', which is not a valid return value from '%s'" 3053,etTypeProviderConstructorException,"The type provider constructor has thrown an exception: %s" 3056,etNullProvidedExpression,"Type provider '%s' returned null from GetInvokerExpression." @@ -1604,7 +1591,6 @@ forFormatInvalidForInterpolated4,"Interpolated strings used as type IFormattable 3388,tcSubsumptionImplicitConversionUsed,"This expression implicitly converts type '%s' to type '%s'. See https://aka.ms/fsharp-implicit-convs." 3389,tcBuiltInImplicitConversionUsed,"This expression uses a built-in implicit conversion to convert type '%s' to type '%s'. See https://aka.ms/fsharp-implicit-convs." 3391,tcImplicitConversionUsedForNonMethodArg,"This expression uses the implicit conversion '%s' to convert type '%s' to type '%s'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn \"3391\"." -#3501 "This construct is not supported by your version of the F# compiler" CompilerMessage(ExperimentalAttributeMessages.NotSupportedYet, 3501, IsError=true) 3390,xmlDocBadlyFormed,"This XML comment is invalid: '%s'" 3390,xmlDocMissingParameterName,"This XML comment is invalid: missing 'name' attribute for parameter or parameter reference" 3390,xmlDocMissingCrossReference,"This XML comment is invalid: missing 'cref' attribute for cross-reference" diff --git a/src/Compiler/TypedTree/TypedTreeOps.fsi b/src/Compiler/TypedTree/TypedTreeOps.fsi index 17d9cc60766..1a89375f930 100755 --- a/src/Compiler/TypedTree/TypedTreeOps.fsi +++ b/src/Compiler/TypedTree/TypedTreeOps.fsi @@ -1665,6 +1665,9 @@ val underlyingTypeOfEnumTy: TcGlobals -> TType -> TType /// If the input type is an enum type, then convert to its underlying type, otherwise return the input type val normalizeEnumTy: TcGlobals -> TType -> TType +/// Determine if TyconRef is to a struct type +val isStructTyconRef: TyconRef -> bool + /// Determine if a type is a struct type val isStructTy: TcGlobals -> TType -> bool diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs.il.debug.bsl index 11721f6522a..cc8f56cd993 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs.il.debug.bsl @@ -66,6 +66,7 @@ .method public hidebysig specialname instance int32 get_hash() cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 ) // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs.il.release.bsl index 5c412d430d3..ed4eefc32ed 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs.il.release.bsl @@ -66,6 +66,7 @@ .method public hidebysig specialname instance int32 get_hash() cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 ) // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StructGettersReadOnly.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StructGettersReadOnly.fs new file mode 100644 index 00000000000..ccb94a97e50 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StructGettersReadOnly.fs @@ -0,0 +1,130 @@ +namespace FSharp.Compiler.ComponentTests.EmittedIL + +open Microsoft.FSharp.Core +open Xunit +open FSharp.Test.Compiler +open FSharp.Test.ReflectionHelper + +module ``Struct getters readonly`` = + + let structRecord = + FSharp + """ + module Test + + [] type MyRecord = { MyField : int } + """ + + [] + let ``Struct record has readonly attribute on getter`` () = + structRecord + |> compileAssembly + |> getType "Test+MyRecord" + |> getMethod "get_MyField" + |> should haveAttribute "IsReadOnlyAttribute" + + [] + let ``Struct record has readonly attribute on getter in IL`` () = + structRecord + |> compile + |> shouldSucceed + |> verifyIL [ """ + .method public hidebysig specialname + instance int32 get_MyField() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 Test/MyRecord::MyField@ + IL_0006: ret + }""" ] + + let nonStructRecord = + FSharp + """ + module Test + + type MyRecord = { MyField : int } + """ + + [] + let ``Non-struct record doesn't have readonly getters`` () = + nonStructRecord + |> compileAssembly + |> getType "Test+MyRecord" + |> getMethod "get_MyField" + |> shouldn't haveAttribute "IsReadOnlyAttribute" + + [] + let ``Non-struct record doesn't have readonly getters in IL`` () = + nonStructRecord + |> compile + |> shouldSucceed + |> verifyIL [ """ + .method public hidebysig specialname + instance int32 get_MyField() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 Test/MyRecord::MyField@ + IL_0006: ret + } """ ] + + [] + let ``Struct anonymous record has readonly attribute on getter`` () = + FSharp + """ + module Test + + let myRecord = struct {| MyField = 3 |} + """ + |> compileAssembly + |> getFirstAnonymousType + |> getMethod "get_MyField" + |> should haveAttribute "IsReadOnlyAttribute" + + [] + let ``Non-struct anonymous record doesn't have readonly attribute on getter`` () = + FSharp + """ + module Test + + let myRecord = {| MyField = 3 |} + """ + |> compileAssembly + |> getFirstAnonymousType + |> getMethod "get_MyField" + |> shouldn't haveAttribute "IsReadOnlyAttribute" + + [] + let ``Struct has readonly getters`` () = + FSharp + """ + module Test + + [] + type MyStruct = + val MyField: int + """ + |> compileAssembly + |> getType "Test+MyStruct" + |> getMethod "get_MyField" + |> should haveAttribute "IsReadOnlyAttribute" + + [] + let ``Custom getter on a struct doesn't have readonly attribute`` () = + FSharp + """ + module Test + + [] + type MyStruct = + val mutable x: int + member this.MyField with get () = this.x <- 4 + """ + |> compileAssembly + |> getType "Test+MyStruct" + |> getMethod "get_MyField" + |> shouldn't haveAttribute "IsReadOnlyAttribute" diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.debug.bsl index 1e35a8e9c26..0e84741e970 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.debug.bsl @@ -65,6 +65,7 @@ .method public hidebysig specialname instance float64 get_F() cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 ) // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 @@ -409,6 +410,7 @@ .method public hidebysig specialname instance float64 get_D() cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 ) // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.release.bsl index caa632f0fa0..9d6c3245635 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.release.bsl @@ -65,6 +65,7 @@ .method public hidebysig specialname instance float64 get_F() cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 ) // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 @@ -376,6 +377,7 @@ .method public hidebysig specialname instance float64 get_D() cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 ) // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index b41d408da26..a899d457f86 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -92,6 +92,7 @@ + @@ -122,6 +123,7 @@ + diff --git a/tests/FSharp.Test.Utilities/Compiler.fs b/tests/FSharp.Test.Utilities/Compiler.fs index a374f3d4475..54822b93d80 100644 --- a/tests/FSharp.Test.Utilities/Compiler.fs +++ b/tests/FSharp.Test.Utilities/Compiler.fs @@ -631,16 +631,27 @@ module rec Compiler = | _ -> failwith "Compilation has errors." - let compileGuid (cUnit: CompilationUnit) : Guid = - let bytes = - compile cUnit - |> shouldSucceed - |> getAssemblyInBytes + let getAssembly = getAssemblyInBytes >> Assembly.Load - use reader1 = new PEReader(bytes.ToImmutableArray()) - let reader1 = reader1.GetMetadataReader() + let withPeReader func compilationResult = + let bytes = getAssemblyInBytes compilationResult + use reader = new PEReader(bytes.ToImmutableArray()) + func reader - reader1.GetModuleDefinition().Mvid |> reader1.GetGuid + let withMetadataReader func = + withPeReader (fun reader -> reader.GetMetadataReader() |> func) + + let compileGuid cUnit = + cUnit + |> compile + |> shouldSucceed + |> withMetadataReader (fun reader -> reader.GetModuleDefinition().Mvid |> reader.GetGuid) + + let compileAssembly cUnit = + cUnit + |> compile + |> shouldSucceed + |> getAssembly let private parseFSharp (fsSource: FSharpCompilationSource) : CompilationResult = let source = fsSource.Source.GetSourceText |> Option.defaultValue "" diff --git a/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj b/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj index c9852f0fb8c..a20052b3f66 100644 --- a/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj +++ b/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj @@ -26,6 +26,7 @@ + diff --git a/tests/FSharp.Test.Utilities/ReflectionHelper.fs b/tests/FSharp.Test.Utilities/ReflectionHelper.fs new file mode 100644 index 00000000000..5759752c706 --- /dev/null +++ b/tests/FSharp.Test.Utilities/ReflectionHelper.fs @@ -0,0 +1,63 @@ +module FSharp.Test.ReflectionHelper + +open System +open System.Reflection + +/// Gets the given type from the assembly (otherwise throws) +let getType typeName (asm: Assembly) = + match asm.GetType(typeName, false) with + | null -> + let allTypes = + asm.GetTypes() + |> Array.map (fun ty -> ty.Name) + |> Array.reduce (fun x y -> $"%s{x}\r%s{y}") + + failwith $"Error: Assembly did not contain type %s{typeName}.\nAll types in asm:\n%s{allTypes}" + | ty -> ty + +/// Gets all anonymous types from the assembly +let getAnonymousTypes (asm: Assembly) = + [ for ty in asm.GetTypes() do + if ty.FullName.StartsWith "<>f__AnonymousType" then ty ] + +/// Gets the first anonymous type from the assembly +let getFirstAnonymousType asm = + match getAnonymousTypes asm with + | ty :: _ -> ty + | [] -> failwith "Error: No anonymous types found in the assembly" + +/// Gets a type's method +let getMethod methodName (ty: Type) = + match ty.GetMethod(methodName) with + | null -> failwith $"Error: Type did not contain member %s{methodName}" + | methodInfo -> methodInfo + +/// Assert that function f returns Ok for given input +let should f x y = + match f x y with + | Ok _ -> () + | Error message -> failwith $"%s{message} but it should" + +/// Assert that function f doesn't return Ok for given input +let shouldn't f x y = + match f x y with + | Ok message -> failwith $"%s{message} but it shouldn't" + | Error _ -> () + +/// Verify the object contains a custom attribute with the given name. E.g. "ObsoleteAttribute" +let haveAttribute attrName thingy = + let attrs = + match box thingy with + | :? Type as ty -> ty.GetCustomAttributes(false) + | :? MethodInfo as mi -> mi.GetCustomAttributes(false) + | :? PropertyInfo as pi -> pi.GetCustomAttributes(false) + | :? EventInfo as ei -> ei.GetCustomAttributes(false) + | _ -> failwith "Error: Unsupported primitive type, unable to get custom attributes." + + let hasAttribute = + attrs |> Array.exists (fun att -> att.GetType().Name = attrName) + + if hasAttribute then + Ok $"'{thingy}' has attribute '{attrName}'" + else + Error $"'{thingy}' doesn't have attribute '{attrName}'" diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.References.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.References.fs index 50805ed6356..6e2f5b08e7c 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.References.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.References.fs @@ -8,15 +8,12 @@ open System.IO open System.Reflection open NUnit.Framework -open Salsa open UnitTests.TestLib.Utils.Asserts open UnitTests.TestLib.Utils.FilesystemHelpers open UnitTests.TestLib.ProjectSystem -open Microsoft.VisualStudio open Microsoft.VisualStudio.FSharp.ProjectSystem open Microsoft.VisualStudio.Shell.Interop -open Microsoft.Win32 open System.Xml.Linq [][] @@ -25,26 +22,12 @@ type References() = //TODO: look for a way to remove the helper functions static let currentFrameworkDirectory = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory() - static let Net20AssemExPath () = - let key = @"SOFTWARE\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\Public Assemblies (Common Files)" - let hklm = Registry.LocalMachine - let rkey = hklm.OpenSubKey(key) - let path = rkey.GetValue("") :?> string - if String.IsNullOrEmpty(path) then None - else Some(path) ///////////////////////////////// // project helpers static let SaveProject(project : UnitTestingFSharpProjectNode) = project.Save(null, 1, 0u) |> ignore - static let DefaultBuildActionOfFilename(filename) : Salsa.BuildAction = - match Path.GetExtension(filename) with - | ".fsx" -> Salsa.BuildAction.None - | ".resx" - | ".resources" -> Salsa.BuildAction.EmbeddedResource - | _ -> Salsa.BuildAction.Compile - static let GetReferenceContainerNode(project : ProjectNode) = let l = new List() project.FindNodesOfType(l) @@ -249,74 +232,6 @@ type References() = with e -> TheTests.HelpfulAssertMatches ' ' "A reference to '.*' could not be added. A reference to the component '.*' already exists in the project." e.Message - [] - [] - member public this.``ReferenceResolution.Bug650591.AutomationReference.Add.FullPath``() = - match Net20AssemExPath() with - | Some(net20) -> - let invoker = - { - new Microsoft.Internal.VisualStudio.Shell.Interop.IVsInvokerPrivate with - member this.Invoke(invokable) = invokable.Invoke() - } - let log = - { - new Microsoft.VisualStudio.Shell.Interop.IVsActivityLog with - member this.LogEntry(_, _, _) = VSConstants.S_OK - member this.LogEntryGuid(_, _, _, _) = VSConstants.S_OK - member this.LogEntryGuidHr(_, _, _, _, _) = VSConstants.S_OK - member this.LogEntryGuidHrPath(_, _, _, _, _, _) = VSConstants.S_OK - member this.LogEntryGuidPath(_, _, _, _, _) = VSConstants.S_OK - member this.LogEntryHr(_, _, _, _) = VSConstants.S_OK - member this.LogEntryHrPath(_, _, _, _, _) = VSConstants.S_OK - member this.LogEntryPath(_, _, _, _) = VSConstants.S_OK - } - let mocks = - [ - typeof.GUID, box invoker - typeof.GUID, box log - ] |> dict - let mockProvider = - { - new Microsoft.VisualStudio.OLE.Interop.IServiceProvider with - member this.QueryService(guidService, riid, punk) = - match mocks.TryGetValue guidService with - | true, v -> - punk <- System.Runtime.InteropServices.Marshal.GetIUnknownForObject(v) - VSConstants.S_OK - | _ -> - punk <- IntPtr.Zero - VSConstants.E_NOINTERFACE - } - - let _ = Microsoft.VisualStudio.Shell.ServiceProvider.CreateFromSetSite(mockProvider) - let envDte80RefAssemPath = Path.Combine(net20, "EnvDTE80.dll") - let dirName = Path.GetTempPath() - let copy = Path.Combine(dirName, "EnvDTE80.dll") - try - File.Copy(envDte80RefAssemPath, copy, true) - this.MakeProjectAndDo - ( - ["DoesNotMatter.fs"], - [], - "", - fun proj -> - let refContainer = GetReferenceContainerNode(proj) - let automationRefs = refContainer.Object :?> Automation.OAReferences - automationRefs.Add(copy) |> ignore - SaveProject(proj) - let fsprojFileText = File.ReadAllText(proj.FileName) - printfn "%s" fsprojFileText - let expectedFsProj = - @"" - + @"\s*\.\.\\EnvDTE80.dll" - + @"\s*" - TheTests.HelpfulAssertMatches '<' expectedFsProj fsprojFileText - ) - finally - File.Delete(copy) - | _ -> () - /// Create a dummy project named 'Test', build it, and then call k with the full path to the resulting exe member public this.CreateDummyTestProjectBuildItAndDo(k : string -> unit) = this.MakeProjectAndDo(["foo.fs"], [], "", (fun project -> From 795248acf16bc1a8e169d0e759c375a43bac7e8b Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Tue, 12 Jul 2022 07:42:24 -0700 Subject: [PATCH 03/51] Localized file check-in by OneLocBuild Task: Build definition ID 499: Build ID 1866071 (#13444) (#13476) * Localized file check-in by OneLocBuild Task: Build definition ID 499: Build ID 1865104 * Localized file check-in by OneLocBuild Task: Build definition ID 499: Build ID 1865320 Co-authored-by: Kevin Ransom (msft) Co-authored-by: Kevin Ransom (msft) --- src/Compiler/xlf/FSComp.txt.cs.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.de.xlf | 6 +++--- src/Compiler/xlf/FSComp.txt.es.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.fr.xlf | 6 +++--- src/Compiler/xlf/FSComp.txt.it.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.ja.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.ko.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.pl.xlf | 6 +++--- src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 6 +++--- src/Compiler/xlf/FSComp.txt.ru.xlf | 6 +++--- src/Compiler/xlf/FSComp.txt.tr.xlf | 6 +++--- src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 4 ++-- 13 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index 9d4c5a11d53..a35ece58510 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -519,7 +519,7 @@ Expecting expression - Expecting expression + Byl očekáván výraz. @@ -5829,7 +5829,7 @@ This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). - Toto není platný číselný literál. Mezi platné číselné literály patří 1, 0x1, 0o1, 0b1, 1l (int), 1u (uint32), 1L (int64), 1UL (uint64), 1s (int16), 1y (sbyte), 1uy (byte), 1.0 (float), 1.0f (float32), 1.0m (decimal), 1I (BigInteger). + This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index f2ab77d258a..82283fe4ef5 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -519,7 +519,7 @@ Expecting expression - Expecting expression + Ausdruck wird erwartet @@ -5069,7 +5069,7 @@ Source link information file to embed in the portable PDB file - Die Datei mit Quelllinkinformationen, die in die portierbare PDB-Datei eingebettet werden soll + Die Datei mit Informationen zur Quellverknüpfung, die in die portierbare PDB-Datei eingebettet werden soll @@ -5829,7 +5829,7 @@ This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). - Dies ist kein gültiges numerisches Literal. Unter anderem sind die folgenden numerischen Literale gültig: 1, 0x1, 0o1, 0b1, 1l (int), 1u (uint32), 1L (int64), 1UL (uint64), 1s (int16), 1y (sbyte), 1uy (byte), 1.0 (float), 1.0f (float32), 1.0m (decimal), 1I (BigInteger). + This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index 155775b3641..e886d028615 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -519,7 +519,7 @@ Expecting expression - Expecting expression + Se espera una expresión @@ -5829,7 +5829,7 @@ This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). - Este literal numérico no es válido. Entre los literales numéricos válidos se incluyen 1, 0x1, 0o1, 0b1, 1l (int), 1u (uint32), 1L (int64), 1UL (uint64), 1s (int16), 1y (sbyte), 1uy (byte), 1.0 (float), 1.0f (float32), 1.0m (decimal) y 1I (BigInteger). + This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index 648d7d4bf73..4990250d81c 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -519,7 +519,7 @@ Expecting expression - Expecting expression + Expression attendue @@ -5069,7 +5069,7 @@ Source link information file to embed in the portable PDB file - Fichier d'informations sur le lien source à incorporer dans le fichier PDB portable + Fichier d'informations Source Link à incorporer dans le fichier PDB portable @@ -5829,7 +5829,7 @@ This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). - Littéral numérique non valide. Littéraux numériques valides : 1, 0x1, 0o1, 0b1, 1l (int), 1u (uint32), 1L (int64), 1UL (uint64), 1s (int16), 1y (sbyte), 1uy (byte), 1.0 (float), 1.0f (float32), 1.0m (decimal), 1I (BigInteger). + This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index ee8dd3fe6e0..f32f9891d15 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -519,7 +519,7 @@ Expecting expression - Expecting expression + Prevista espressione. @@ -5829,7 +5829,7 @@ This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). - Questo non è un valore letterale numerico valido. I valori letterali numerici validi includono 1, 0x1, 0o1, 0b1, 1l (int), 1u (uint32), 1L (int64), 1UL (uint64), 1s (int16), 1y (sbyte), 1uy (byte), 1.0 (float), 1.0f (float32), 1.0m (decimal), 1I (BigInteger). + This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index a1c7469c781..082c4e84a92 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -519,7 +519,7 @@ Expecting expression - Expecting expression + 式を指定してください @@ -5829,7 +5829,7 @@ This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). - これは有効な数値リテラルではありません。有効な数値リテラルの例には、1、0x1、0o1、0b1、1l (int)、1u (uint32)、1L (int64)、1UL (uint64)、1s (int16)、1y (sbyte)、1uy (byte)、1.0 (float)、1.0f (float32)、1.0m (decimal)、1I (BigInteger) などがあります。 + This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 814daf648a5..06669718825 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -519,7 +519,7 @@ Expecting expression - Expecting expression + 식이 필요함 @@ -5829,7 +5829,7 @@ This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). - 유효한 숫자 리터럴이 아닙니다. 유효한 숫자 리터럴로는 1, 0x1, 0o1, 0b1, 1l(int), 1u(uint32), 1L(int64), 1UL(uint64), 1s(int16), 1y(sbyte), 1uy(byte), 1.0(float), 1.0f(float32), 1.0m(decimal), 1I(BigInteger) 등이 있습니다. + This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index fe4e3483e0c..911efdac74d 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -519,7 +519,7 @@ Expecting expression - Expecting expression + Oczekiwanie na wyrażenie @@ -5069,7 +5069,7 @@ Source link information file to embed in the portable PDB file - Plik informacji o linku kodu źródłowego do osadzenia w przenośnym pliku PDB + Plik informacji o linku do źródła do osadzenia w przenośnym pliku PDB @@ -5829,7 +5829,7 @@ This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). - Jest to nieprawidłowy literał liczbowy. Do prawidłowych literałów liczbowych należą: 1, 0x1, 0o1, 0b1, 1l (int), 1u (uint32), 1L (int64), 1UL (uint64), 1s (int16), 1y (sbyte), 1uy (byte), 1.0 (float), 1.0f (float32), 1.0m (decimal), 1I (BigInteger). + This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 73ff934d074..22bb59aa8bd 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -519,7 +519,7 @@ Expecting expression - Expecting expression + Esperando uma expressão @@ -5069,7 +5069,7 @@ Source link information file to embed in the portable PDB file - O arquivo de informações do link de origem para inserir em um arquivo PDB portátil + O arquivo de informações do Source Link para inserir em um arquivo PDB portátil @@ -5829,7 +5829,7 @@ This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). - Este não é um literal numérico válido. Literais numéricos válidos incluem 1, 0x1, 0o1, 0b1, 1l (int), 1u (uint32), 1L (int64), 1UL (uint64), 1s (int16), 1y (sbyte), 1uy (byte), 1.0 (float), 1.0f (float32), 1.0m (decimal), 1I (BigInteger). + This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index 3b8b2d7feea..30563882224 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -519,7 +519,7 @@ Expecting expression - Expecting expression + Ожидается выражение @@ -5069,7 +5069,7 @@ Source link information file to embed in the portable PDB file - Файл со сведениями о компоновке источников, внедряемый в переносимый PDB-файл + Файл со сведениями об исходной ссылке, внедряемой в переносимый PDB-файл @@ -5829,7 +5829,7 @@ This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). - Это не является допустимым числовым литералом. Допустимые числовые литералы: 1, 0x1, 0o1, 0b1, 1l (int), 1u (uint32), 1L (int64), 1UL (uint64), 1s (int16), 1y (sbyte), 1uy (byte), 1.0 (float), 1.0f (float32), 1.0m (decimal), 1I (BigInteger). + This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index d280a4cbbc3..94f5f37e105 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -519,7 +519,7 @@ Expecting expression - Expecting expression + İfade bekleniyor @@ -5069,7 +5069,7 @@ Source link information file to embed in the portable PDB file - Taşınabilir PDB dosyasına eklenecek kaynak bağlantı bilgileri dosyası + Taşınabilir PDB dosyasına eklenecek kaynak bağlantısı bilgileri dosyası @@ -5829,7 +5829,7 @@ This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). - Bu geçerli bir sayısal sabit değer değil. Geçerli sayısal sabit değerler şunları içerir: 1, 0x1, 0o1, 0b1, 1l (int), 1u (uint32), 1L (int64), 1UL (uint64), 1s (int16), 1y (sbyte), 1uy (byte), 1.0 (float), 1.0f (float32), 1.0m (decimal), 1I (BigInteger). + This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index 8218cb9b37b..71f44423b0c 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -519,7 +519,7 @@ Expecting expression - Expecting expression + 应为表达式 @@ -5829,7 +5829,7 @@ This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). - 这不是有效的数字文本。有效的数字文本包括 1、0x1、0o1、0b1、1l (int)、1u (uint32)、1L (int64)、1UL (uint64)、1s (int16)、1y (sbyte)、1uy (byte)、1.0 (float)、1.0f (float32)、1.0m (decimal)、1I (BigInteger)。 + This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index 47ccd3f0e3d..8788739eb7c 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -519,7 +519,7 @@ Expecting expression - Expecting expression + 必須是運算式 @@ -5829,7 +5829,7 @@ This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). - 這不是有效的數值常值。有效的數值常值包括 1、0x1、0o1、0b1、1l (int)、1u (uint32)、1L (int64)、1UL (uint64)、1s (int16)、1y (sbyte)、1uy (byte)、1.0 (float)、1.0f (float32)、1.0m (decimal)、1I (BigInteger)。 + This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). From 65643c1e4bb6f59a3ddf14c96df9ed7039a0d5c4 Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Tue, 12 Jul 2022 12:50:30 -0700 Subject: [PATCH 04/51] Merge main to release/dev17.4 (#13492) * ValRepInfoForDisplay added for improved quick info for functions defined in expressions * Update * Update QuickInfoTests.fs * Update QuickInfoTests.fs * Update * add identifier analysis script (#13486) * add identifier analysis script * add identifier analysis script * Update fantomas alpha 11 (#13481) Co-authored-by: Don Syme Co-authored-by: Peter Semkin Co-authored-by: Don Syme Co-authored-by: Florian Verdonck Co-authored-by: Petr Semkin --- .config/dotnet-tools.json | 2 +- src/Compiler/AbstractIL/il.fs | 62 ++-- src/Compiler/AbstractIL/ilnativeres.fs | 12 +- src/Compiler/AbstractIL/ilprint.fs | 60 ++-- src/Compiler/AbstractIL/ilread.fs | 81 +++--- src/Compiler/AbstractIL/ilreflect.fs | 57 ++-- src/Compiler/AbstractIL/ilsupp.fs | 6 +- src/Compiler/AbstractIL/ilsupp.fsi | 12 +- src/Compiler/AbstractIL/ilwritepdb.fs | 22 +- src/Compiler/AbstractIL/ilx.fs | 2 +- src/Compiler/AbstractIL/ilx.fsi | 2 +- src/Compiler/Checking/CheckExpressions.fs | 52 ++-- src/Compiler/Checking/CheckExpressions.fsi | 3 +- .../Checking/CheckIncrementalClasses.fs | 8 +- src/Compiler/Checking/NicePrint.fs | 3 +- src/Compiler/CodeGen/EraseClosures.fs | 16 +- src/Compiler/CodeGen/EraseUnions.fs | 17 +- src/Compiler/CodeGen/IlxGen.fs | 275 +++++++++++------- src/Compiler/Driver/CompilerConfig.fs | 26 +- src/Compiler/Driver/CompilerDiagnostics.fs | 13 +- src/Compiler/Driver/CompilerImports.fs | 29 +- src/Compiler/Driver/CompilerOptions.fs | 17 +- src/Compiler/Driver/CreateILModule.fs | 25 +- src/Compiler/Driver/FxResolver.fs | 24 +- src/Compiler/Driver/OptimizeInputs.fs | 6 +- src/Compiler/Driver/ParseAndCheckInputs.fs | 3 +- src/Compiler/Driver/ScriptClosure.fs | 3 +- src/Compiler/Driver/StaticLinking.fs | 13 +- src/Compiler/Driver/XmlDocFileWriter.fs | 7 +- src/Compiler/Driver/fsc.fs | 40 ++- src/Compiler/Service/FSharpCheckerResults.fs | 24 +- .../Service/FSharpParseFileResults.fs | 13 +- src/Compiler/Service/ItemKey.fs | 8 +- .../Service/SemanticClassification.fs | 20 +- src/Compiler/Service/ServiceAnalysis.fs | 15 +- .../Service/ServiceInterfaceStubGenerator.fs | 34 ++- src/Compiler/Service/ServiceLexing.fs | 6 +- src/Compiler/Service/ServiceNavigation.fs | 8 +- .../Service/ServiceParamInfoLocations.fs | 12 +- src/Compiler/Service/ServiceParseTreeWalk.fs | 21 +- src/Compiler/Service/ServiceParsedInputOps.fs | 8 +- src/Compiler/Service/ServiceStructure.fs | 30 +- src/Compiler/Service/service.fs | 10 +- src/Compiler/SyntaxTree/LexHelpers.fs | 14 +- src/Compiler/SyntaxTree/ParseHelpers.fs | 2 +- src/Compiler/SyntaxTree/PrettyNaming.fs | 8 +- src/Compiler/SyntaxTree/XmlDoc.fs | 5 +- src/Compiler/TypedTree/TypedTree.fs | 19 ++ src/Compiler/TypedTree/TypedTree.fsi | 13 + src/Compiler/TypedTree/TypedTreeBasics.fs | 20 +- src/Compiler/TypedTree/TypedTreeBasics.fsi | 4 + src/Compiler/TypedTree/TypedTreeOps.fs | 3 +- src/Compiler/TypedTree/TypedTreePickle.fs | 1 + src/Compiler/Utilities/FileSystem.fs | 18 +- src/Compiler/Utilities/HashMultiMap.fs | 3 +- src/Compiler/Utilities/ImmutableArray.fs | 9 +- src/Compiler/Utilities/ResizeArray.fs | 13 +- src/Compiler/Utilities/illib.fs | 11 +- src/Compiler/Utilities/range.fs | 24 +- src/Compiler/Utilities/sformat.fs | 35 ++- src/FSharp.Build/FSharpEmbedResXSource.fs | 8 +- src/FSharp.Core/QueryExtensions.fs | 2 +- src/FSharp.Core/array.fs | 11 +- src/FSharp.Core/async.fs | 19 +- src/FSharp.Core/eventmodule.fs | 6 +- src/FSharp.Core/list.fs | 13 +- src/FSharp.Core/map.fs | 6 +- src/FSharp.Core/observable.fs | 20 +- src/FSharp.Core/quotations.fs | 8 +- src/FSharp.Core/reflect.fs | 30 +- src/FSharp.Core/seq.fs | 61 ++-- .../FSharp.DependencyManager.Utilities.fs | 4 +- src/fsc/fscmain.fs | 6 +- src/fsi/console.fs | 15 +- src/fsi/fsimain.fs | 6 +- tests/scripts/identifierAnalysisByType.fsx | 152 ++++++++++ .../tests/UnitTests/QuickInfoTests.fs | 41 +-- 77 files changed, 1147 insertions(+), 570 deletions(-) create mode 100644 tests/scripts/identifierAnalysisByType.fsx diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index b56be5549a4..98702f25d91 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "fantomas": { - "version": "5.0.0-alpha-008", + "version": "5.0.0-alpha-011", "commands": [ "fantomas" ] diff --git a/src/Compiler/AbstractIL/il.fs b/src/Compiler/AbstractIL/il.fs index ed951e0a03b..3600b0e2cf4 100644 --- a/src/Compiler/AbstractIL/il.fs +++ b/src/Compiler/AbstractIL/il.fs @@ -25,7 +25,9 @@ open Internal.Utilities let logging = false -let _ = if logging then dprintn "* warning: Il.logging is on" +let _ = + if logging then + dprintn "* warning: Il.logging is on" let int_order = LanguagePrimitives.FastGenericComparer @@ -68,11 +70,13 @@ let memoizeNamespaceRightTable = let memoizeNamespacePartTable = ConcurrentDictionary() let splitNameAt (nm: string) idx = - if idx < 0 then failwith "splitNameAt: idx < 0" + if idx < 0 then + failwith "splitNameAt: idx < 0" let last = nm.Length - 1 - if idx > last then failwith "splitNameAt: idx > last" + if idx > last then + failwith "splitNameAt: idx > last" (nm.Substring(0, idx)), (if idx < last then nm.Substring(idx + 1, last - idx) else "") @@ -551,7 +555,8 @@ type ILAssemblyRef(data) = addC (convDigit (int32 v / 16)) addC (convDigit (int32 v % 16)) // retargetable can be true only for system assemblies that definitely have Version - if aref.Retargetable then add ", Retargetable=Yes" + if aref.Retargetable then + add ", Retargetable=Yes" b.ToString() @@ -2497,8 +2502,10 @@ let typeKindOfFlags nm (super: ILType option) flags = if name = "System.Enum" then ILTypeDefKind.Enum - elif (name = "System.Delegate" && nm <> "System.MulticastDelegate") - || name = "System.MulticastDelegate" then + elif + (name = "System.Delegate" && nm <> "System.MulticastDelegate") + || name = "System.MulticastDelegate" + then ILTypeDefKind.Delegate elif name = "System.ValueType" && nm <> "System.Enum" then ILTypeDefKind.ValueType @@ -3925,7 +3932,8 @@ let cdef_cctorCode2CodeOrCreate tag imports f (cd: ILTypeDef) = [| yield f cctor for md in mdefs do - if md.Name <> ".cctor" then yield md + if md.Name <> ".cctor" then + yield md |]) cd.With(methods = methods) @@ -4888,7 +4896,8 @@ type ILTypeSigParser(tstring: string) = // Does the type name start with a leading '['? If so, ignore it // (if the specialization type is in another module, it will be wrapped in bracket) - if here () = '[' then drop () + if here () = '[' then + drop () // 1. Iterate over beginning of type, grabbing the type name and determining if it's generic or an array let typeName = @@ -4947,8 +4956,11 @@ type ILTypeSigParser(tstring: string) = let scope = if (here () = ',' || here () = ' ') && (peek () <> '[' && peekN 2 <> '[') then let grabScopeComponent () = - if here () = ',' then drop () // ditch the ',' - if here () = ' ' then drop () // ditch the ' ' + if here () = ',' then + drop () // ditch the ',' + + if here () = ' ' then + drop () // ditch the ' ' while (peek () <> ',' && peek () <> ']' && peek () <> nil) do step () @@ -4969,8 +4981,11 @@ type ILTypeSigParser(tstring: string) = ILScopeRef.Local // strip any extraneous trailing brackets or commas - if (here () = ']') then drop () - if (here () = ',') then drop () + if (here () = ']') then + drop () + + if (here () = ',') then + drop () // build the IL type let tref = mkILTyRef (scope, typeName) @@ -5549,17 +5564,18 @@ let resolveILMethodRefWithRescope r (td: ILTypeDef) (mref: ILMethodRef) = let argTypes = mref.ArgTypes |> List.map r let retType: ILType = r mref.ReturnType - match possibles - |> List.filter (fun md -> - mref.CallingConv = md.CallingConv - && - // REVIEW: this uses equality on ILType. For CMOD_OPTIONAL this is not going to be correct - (md.Parameters, argTypes) - ||> List.lengthsEqAndForall2 (fun p1 p2 -> r p1.Type = p2) - && - // REVIEW: this uses equality on ILType. For CMOD_OPTIONAL this is not going to be correct - r md.Return.Type = retType) - with + match + possibles + |> List.filter (fun md -> + mref.CallingConv = md.CallingConv + && + // REVIEW: this uses equality on ILType. For CMOD_OPTIONAL this is not going to be correct + (md.Parameters, argTypes) + ||> List.lengthsEqAndForall2 (fun p1 p2 -> r p1.Type = p2) + && + // REVIEW: this uses equality on ILType. For CMOD_OPTIONAL this is not going to be correct + r md.Return.Type = retType) + with | [] -> failwith ( "no method named " diff --git a/src/Compiler/AbstractIL/ilnativeres.fs b/src/Compiler/AbstractIL/ilnativeres.fs index 3c0752ea8db..70846577d68 100644 --- a/src/Compiler/AbstractIL/ilnativeres.fs +++ b/src/Compiler/AbstractIL/ilnativeres.fs @@ -96,8 +96,10 @@ type CvtResFile() = reader.Read(pAdditional.data, 0, pAdditional.data.Length) |> ignore stream.Position <- stream.Position + 3L &&& ~~~ 3L - if pAdditional.pstringType.theString = Unchecked.defaultof<_> - && (pAdditional.pstringType.Ordinal = uint16 CvtResFile.RT_DLGINCLUDE) then + if + pAdditional.pstringType.theString = Unchecked.defaultof<_> + && (pAdditional.pstringType.Ordinal = uint16 CvtResFile.RT_DLGINCLUDE) + then () (* ERROR ContinueNotSupported *) else resourceNames.Add pAdditional @@ -454,7 +456,8 @@ type VersionHelper() = doBreak <- false () (* ERROR ContinueNotSupported *) (* ERROR BreakNotSupported *) - if not breakLoop then i <- i + 1 + if not breakLoop then + i <- i + 1 if hasWildcard then let mutable (i: int) = lastExplicitValue @@ -1149,7 +1152,8 @@ type NativeResourceWriter() = if id >= 0 then writer.WriteInt32 id else - if name = Unchecked.defaultof<_> then name <- String.Empty + if name = Unchecked.defaultof<_> then + name <- String.Empty writer.WriteUInt32(nameOffset ||| 0x80000000u) dataWriter.WriteUInt16(uint16 name.Length) diff --git a/src/Compiler/AbstractIL/ilprint.fs b/src/Compiler/AbstractIL/ilprint.fs index a9f95cbc1b0..1c777f278b9 100644 --- a/src/Compiler/AbstractIL/ilprint.fs +++ b/src/Compiler/AbstractIL/ilprint.fs @@ -661,16 +661,20 @@ let goutput_fdef _tref env os (fd: ILFieldDef) = output_member_access os fd.Access output_string os " " - if fd.IsStatic then output_string os " static " + if fd.IsStatic then + output_string os " static " - if fd.IsLiteral then output_string os " literal " + if fd.IsLiteral then + output_string os " literal " if fd.IsSpecialName then output_string os " specialname rtspecialname " - if fd.IsInitOnly then output_string os " initonly " + if fd.IsInitOnly then + output_string os " initonly " - if fd.NotSerialized then output_string os " notserialized " + if fd.NotSerialized then + output_string os " notserialized " goutput_typ env os fd.FieldType output_string os " " @@ -740,7 +744,8 @@ let output_code_label os lab = output_string os (formatCodeLabel lab) let goutput_local env os (l: ILLocal) = goutput_typ env os l.Type - if l.IsPinned then output_string os " pinned" + if l.IsPinned then + output_string os " pinned" let goutput_param env os (l: ILParameter) = match l.Name with @@ -985,7 +990,8 @@ let rec goutput_instr env os inst = let rank = shape.Rank output_parens (output_array ", " (goutput_typ env)) os (Array.create rank PrimaryAssemblyILGlobals.typ_Int32) | I_ldelema (ro, _, shape, tok) -> - if ro = ReadonlyAddress then output_string os "readonly. " + if ro = ReadonlyAddress then + output_string os "readonly. " if shape = ILArrayShape.SingleDimensional then output_string os "ldelema " @@ -1034,7 +1040,8 @@ let rec goutput_instr env os inst = | _ -> output_string os "" let goutput_ilmbody env os (il: ILMethodBody) = - if il.IsZeroInit then output_string os " .zeroinit\n" + if il.IsZeroInit then + output_string os " .zeroinit\n" output_string os " .maxstack " output_i32 os il.MaxStack @@ -1067,7 +1074,8 @@ let goutput_mbody is_entrypoint env os (md: ILMethodDef) = | MethodBody.IL il -> goutput_ilmbody env os il.Value | _ -> () - if is_entrypoint then output_string os " .entrypoint" + if is_entrypoint then + output_string os " .entrypoint" output_string os "\n" output_string os "}\n" @@ -1125,11 +1133,14 @@ let goutput_mdef env os (md: ILMethodDef) = let menv = ppenv_enter_method (List.length md.GenericParams) env output_string os " .method " - if md.IsHideBySig then output_string os "hidebysig " + if md.IsHideBySig then + output_string os "hidebysig " - if md.IsReqSecObj then output_string os "reqsecobj " + if md.IsReqSecObj then + output_string os "reqsecobj " - if md.IsSpecialName then output_string os "specialname " + if md.IsSpecialName then + output_string os "specialname " if md.IsUnmanagedExport then output_string os "unmanagedexp " @@ -1149,13 +1160,17 @@ let goutput_mdef env os (md: ILMethodDef) = (goutput_params menv) os md.Parameters output_string os " " - if md.IsSynchronized then output_string os "synchronized " + if md.IsSynchronized then + output_string os "synchronized " - if md.IsMustRun then output_string os "/* mustrun */ " + if md.IsMustRun then + output_string os "/* mustrun */ " - if md.IsPreserveSig then output_string os "preservesig " + if md.IsPreserveSig then + output_string os "preservesig " - if md.IsNoInline then output_string os "noinlining " + if md.IsNoInline then + output_string os "noinlining " if md.IsAggressiveInline then output_string os "aggressiveinlining " @@ -1255,13 +1270,17 @@ let rec goutput_tdef enc env contents os (cd: ILTypeDef) = output_string os layout_attr output_string os " " - if cd.IsSealed then output_string os "sealed " + if cd.IsSealed then + output_string os "sealed " - if cd.IsAbstract then output_string os "abstract " + if cd.IsAbstract then + output_string os "abstract " - if cd.IsSerializable then output_string os "serializable " + if cd.IsSerializable then + output_string os "serializable " - if cd.IsComInterop then output_string os "import " + if cd.IsComInterop then + output_string os "import " output_sqstring os cd.Name goutput_gparams env os cd.GenericParams @@ -1339,7 +1358,8 @@ let output_assemblyRef os (aref: ILAssemblyRef) = output_string os " .assembly extern " output_sqstring os aref.Name - if aref.Retargetable then output_string os " retargetable " + if aref.Retargetable then + output_string os " retargetable " output_string os " { " output_option output_hash os aref.Hash diff --git a/src/Compiler/AbstractIL/ilread.fs b/src/Compiler/AbstractIL/ilread.fs index 3b536d891fd..6ec589b3115 100644 --- a/src/Compiler/AbstractIL/ilread.fs +++ b/src/Compiler/AbstractIL/ilread.fs @@ -1379,7 +1379,8 @@ let seekReadGuidIdx (ctxt: ILMetadataReader) mdv (addr: byref) = seekReadId let seekReadBlobIdx (ctxt: ILMetadataReader) mdv (addr: byref) = seekReadIdx ctxt.blobsBigness mdv &addr let seekReadModuleRow (ctxt: ILMetadataReader) mdv idx = - if idx = 0 then failwith "cannot read Module table row 0" + if idx = 0 then + failwith "cannot read Module table row 0" let mutable addr = ctxt.rowAddr TableNames.Module idx let generation = seekReadUInt16Adv mdv &addr @@ -1846,7 +1847,9 @@ let getDataEndPointsDelayed (pectxt: PEReader) ctxtH = |> List.sort let rvaToData (ctxt: ILMetadataReader) (pectxt: PEReader) nm rva = - if rva = 0x0 then failwith "rva is zero" + if rva = 0x0 then + failwith "rva is zero" + let start = pectxt.anyV2P (nm, rva) let endPoints = (Lazy.force ctxt.dataEndPoints) @@ -2565,7 +2568,8 @@ and sigptrGetTy (ctxt: ILMetadataReader) numTypars bytes sigptr = let ccByte, sigptr = sigptrGetByte bytes sigptr let generic, cc = byteAsCallConv ccByte - if generic then failwith "fptr sig may not be generic" + if generic then + failwith "fptr sig may not be generic" let struct (numparams, sigptr) = sigptrGetZInt32 bytes sigptr let retTy, sigptr = sigptrGetTy ctxt numTypars bytes sigptr @@ -3082,16 +3086,15 @@ and seekReadEvents (ctxt: ILMetadataReader) numTypars tidx = let mdv = ctxt.mdfile.GetView() match - seekReadOptionalIndexedRow - ( - ctxt.getNumRows TableNames.EventMap, - (fun i -> i, seekReadEventMapRow ctxt mdv i), - (fun (_, row) -> fst row), - compare tidx, - false, - (fun (i, row) -> (i, snd row)) - ) - with + seekReadOptionalIndexedRow ( + ctxt.getNumRows TableNames.EventMap, + (fun i -> i, seekReadEventMapRow ctxt mdv i), + (fun (_, row) -> fst row), + compare tidx, + false, + (fun (i, row) -> (i, snd row)) + ) + with | None -> [] | Some (rowNum, beginEventIdx) -> let endEventIdx = @@ -3150,16 +3153,15 @@ and seekReadProperties (ctxt: ILMetadataReader) numTypars tidx = let mdv = ctxt.mdfile.GetView() match - seekReadOptionalIndexedRow - ( - ctxt.getNumRows TableNames.PropertyMap, - (fun i -> i, seekReadPropertyMapRow ctxt mdv i), - (fun (_, row) -> fst row), - compare tidx, - false, - (fun (i, row) -> (i, snd row)) - ) - with + seekReadOptionalIndexedRow ( + ctxt.getNumRows TableNames.PropertyMap, + (fun i -> i, seekReadPropertyMapRow ctxt mdv i), + (fun (_, row) -> fst row), + compare tidx, + false, + (fun (i, row) -> (i, snd row)) + ) + with | None -> [] | Some (rowNum, beginPropIdx) -> let endPropIdx = @@ -3592,17 +3594,21 @@ and seekReadTopCode (ctxt: ILMetadataReader) pev mdv numTypars (sz: int) start s curr <- curr + 4 (* REVIEW: this incorrectly labels all MemberRef tokens as ILMethod's: we should go look at the MemberRef sig to determine if it is a field or method *) let token_info = - if tab = TableNames.Method - || tab = TableNames.MemberRef (* REVIEW: generics or tab = TableNames.MethodSpec *) then + if + tab = TableNames.Method + || tab = TableNames.MemberRef (* REVIEW: generics or tab = TableNames.MethodSpec *) + then let (MethodData (enclTy, cc, nm, argTys, retTy, methInst)) = seekReadMethodDefOrRefNoVarargs ctxt numTypars (uncodedTokenToMethodDefOrRef (tab, idx)) ILToken.ILMethod(mkILMethSpecInTy (enclTy, cc, nm, argTys, retTy, methInst)) elif tab = TableNames.Field then ILToken.ILField(seekReadFieldDefAsFieldSpec ctxt idx) - elif tab = TableNames.TypeDef - || tab = TableNames.TypeRef - || tab = TableNames.TypeSpec then + elif + tab = TableNames.TypeDef + || tab = TableNames.TypeRef + || tab = TableNames.TypeSpec + then ILToken.ILType(seekReadTypeDefOrRef ctxt numTypars AsObject [] (uncodedTokenToTypeDefOrRefOrSpec (tab, idx))) else failwith "bad token for ldtoken" @@ -3680,7 +3686,8 @@ and seekReadMethodRVA (pectxt: PEReader) (ctxt: ILMetadataReader) (idx, nm, _int let isFatFormat = (b &&& e_CorILMethod_FormatMask) = e_CorILMethod_FatFormat if not isTinyFormat && not isFatFormat then - if logging then failwith "unknown format" + if logging then + failwith "unknown format" MethodBody.Abstract else @@ -3924,7 +3931,8 @@ and seekReadMethodRVA (pectxt: PEReader) (ctxt: ILMetadataReader) (idx, nm, _int nextSectionBase <- sectionBase + sectionSize // Convert the linear code format to the nested code format - if logging then dprintn "doing localPdbInfos2" + if logging then + dprintn "doing localPdbInfos2" let localPdbInfos2 = List.map (fun f -> f raw2nextLab) localPdbInfos @@ -3933,7 +3941,8 @@ and seekReadMethodRVA (pectxt: PEReader) (ctxt: ILMetadataReader) (idx, nm, _int let code = buildILCode nm lab2pc instrs seh localPdbInfos2 - if logging then dprintn "done checking code." + if logging then + dprintn "done checking code." { IsZeroInit = initlocals @@ -4254,10 +4263,10 @@ let openMetadataReader | Some positions -> positions let tablesStreamPhysLoc, _tablesStreamSize = - match tryFindStream [| 0x23; 0x7e |] (* #~ *) with + match tryFindStream [| 0x23; 0x7e |] (* #~ *) with | Some res -> res | None -> - match tryFindStream [| 0x23; 0x2d |] (* #-: at least one DLL I've seen uses this! *) with + match tryFindStream [| 0x23; 0x2d |] (* #-: at least one DLL I've seen uses this! *) with | Some res -> res | None -> let firstStreamOffset = seekReadInt32 mdv (streamHeadersStart + 0) @@ -5073,8 +5082,10 @@ let stableFileHeuristicApplies fileName = let createByteFileChunk opts fileName chunk = // If we're trying to reduce memory usage then we are willing to go back and re-read the binary, so we can use // a weakly-held handle to an array of bytes. - if opts.reduceMemoryUsage = ReduceMemoryFlag.Yes - && stableFileHeuristicApplies fileName then + if + opts.reduceMemoryUsage = ReduceMemoryFlag.Yes + && stableFileHeuristicApplies fileName + then WeakByteFile(fileName, chunk) :> BinaryFile else let bytes = diff --git a/src/Compiler/AbstractIL/ilreflect.fs b/src/Compiler/AbstractIL/ilreflect.fs index 06e2fc67a35..2781d8a381a 100644 --- a/src/Compiler/AbstractIL/ilreflect.fs +++ b/src/Compiler/AbstractIL/ilreflect.fs @@ -638,11 +638,13 @@ let envUpdateCreatedTypeRef emEnv (tref: ILTypeRef) = // of objects. We use System.Runtime.Serialization.FormatterServices.GetUninitializedObject to do // the fake allocation - this creates an "empty" object, even if the object doesn't have // a constructor. It is not usable in partial trust code. - if runningOnMono - && ty.IsClass - && not ty.IsAbstract - && not ty.IsGenericType - && not ty.IsGenericTypeDefinition then + if + runningOnMono + && ty.IsClass + && not ty.IsAbstract + && not ty.IsGenericType + && not ty.IsGenericTypeDefinition + then try System.Runtime.Serialization.FormatterServices.GetUninitializedObject ty |> ignore @@ -972,7 +974,9 @@ let convFieldSpec cenv emEnv fspec = nonQueryableTypeGetField parentTI fieldB else // Prior type. - if typeIsNotQueryable parentTI then + if + typeIsNotQueryable parentTI + then let parentT = getTypeConstructor parentTI let fieldInfo = queryableTypeGetField emEnv parentT fref nonQueryableTypeGetField parentTI fieldInfo @@ -1009,10 +1013,12 @@ let queryableTypeGetMethodBySearch cenv emEnv parentT (mref: ILMethodRef) = | Some a -> if // obvious case - p.IsAssignableFrom a then + p.IsAssignableFrom a + then true elif - p.IsGenericType && a.IsGenericType + p.IsGenericType + && a.IsGenericType // non obvious due to contravariance: Action where T: IFoo accepts Action (for FooImpl: IFoo) && p.GetGenericTypeDefinition().IsAssignableFrom(a.GetGenericTypeDefinition()) then @@ -1124,8 +1130,10 @@ let queryableTypeGetMethod cenv emEnv parentT (mref: ILMethodRef) : MethodInfo = queryableTypeGetMethodBySearch cenv emEnv parentT mref let nonQueryableTypeGetMethod (parentTI: Type) (methInfo: MethodInfo) : MethodInfo MaybeNull = - if (parentTI.IsGenericType - && not (equalTypes parentTI (getTypeConstructor parentTI))) then + if + (parentTI.IsGenericType + && not (equalTypes parentTI (getTypeConstructor parentTI))) + then TypeBuilder.GetMethod(parentTI, methInfo) else methInfo @@ -1141,7 +1149,9 @@ let convMethodRef cenv emEnv (parentTI: Type) (mref: ILMethodRef) = nonQueryableTypeGetMethod parentTI methB else // Prior type. - if typeIsNotQueryable parentTI then + if + typeIsNotQueryable parentTI + then let parentT = getTypeConstructor parentTI let methInfo = queryableTypeGetMethod cenv emEnv parentT mref nonQueryableTypeGetMethod parentTI methInfo @@ -1216,7 +1226,9 @@ let convConstructorSpec cenv emEnv (mspec: ILMethodSpec) = nonQueryableTypeGetConstructor parentTI consB else // Prior type. - if typeIsNotQueryable parentTI then + if + typeIsNotQueryable parentTI + then let parentT = getTypeConstructor parentTI let ctorG = queryableTypeGetConstructor cenv emEnv parentT mref nonQueryableTypeGetConstructor parentTI ctorG @@ -2134,9 +2146,11 @@ let buildFieldPass2 cenv tref (typB: TypeBuilder) emEnv (fdef: ILFieldDef) = match fdef.LiteralValue with | None -> emEnv | Some initial -> - if not fieldT.IsEnum - // it is ok to init fields with type = enum that are defined in other assemblies - || not fieldT.Assembly.IsDynamic then + if + not fieldT.IsEnum + // it is ok to init fields with type = enum that are defined in other assemblies + || not fieldT.Assembly.IsDynamic + then fieldB.SetConstant(initial.AsObject()) emEnv else @@ -2267,9 +2281,10 @@ let typeAttributesOfTypeLayout cenv emEnv x = if p.Size = None && p.Pack = None then None else - match cenv.tryFindSysILTypeRef "System.Runtime.InteropServices.StructLayoutAttribute", - cenv.tryFindSysILTypeRef "System.Runtime.InteropServices.LayoutKind" - with + match + cenv.tryFindSysILTypeRef "System.Runtime.InteropServices.StructLayoutAttribute", + cenv.tryFindSysILTypeRef "System.Runtime.InteropServices.LayoutKind" + with | Some tref1, Some tref2 -> Some( convCustomAttr @@ -2564,7 +2579,8 @@ let createTypeRef (visited: Dictionary<_, _>, created: Dictionary<_, _>) emEnv t match emEnv.emTypMap.TryFind typeRef with | Some (_, tb, _, _) -> - if not (tb.IsCreated()) then tb.CreateTypeAndLog() |> ignore + if not (tb.IsCreated()) then + tb.CreateTypeAndLog() |> ignore tb.Assembly | None -> null) @@ -2590,7 +2606,8 @@ let createTypeRef (visited: Dictionary<_, _>, created: Dictionary<_, _>) emEnv t traverseTypeRef tref let rec buildTypeDefPass4 (visited, created) nesting emEnv (tdef: ILTypeDef) = - if verbose2 then dprintf "buildTypeDefPass4 %s\n" tdef.Name + if verbose2 then + dprintf "buildTypeDefPass4 %s\n" tdef.Name let tref = mkRefForNestedILTypeDef ILScopeRef.Local (nesting, tdef) createTypeRef (visited, created) emEnv tref diff --git a/src/Compiler/AbstractIL/ilsupp.fs b/src/Compiler/AbstractIL/ilsupp.fs index 1db894b1801..fea9a764487 100644 --- a/src/Compiler/AbstractIL/ilsupp.fs +++ b/src/Compiler/AbstractIL/ilsupp.fs @@ -611,7 +611,8 @@ type ResFormatNode(tid: int32, nid: int32, lid: int32, dataOffset: int32, pbLink let bNil = Bytes.zeroCreate 3 // Align remaining fields on DWORD (nb. poor bit twiddling code taken from ildasm's dres.cpp) - if (dwFiller &&& 0x1) <> 0 then SaveChunk(bNil, 2) + if (dwFiller &&& 0x1) <> 0 then + SaveChunk(bNil, 2) //---- Constant part of the header: DWORD, WORD, WORD, DWORD, DWORD SaveChunk(dwToBytes resHdr.DataVersion) @@ -627,7 +628,8 @@ type ResFormatNode(tid: int32, nid: int32, lid: int32, dataOffset: int32, pbLink dwFiller <- dataEntry.Size &&& 0x3 - if dwFiller <> 0 then SaveChunk(bNil, 4 - dwFiller) + if dwFiller <> 0 then + SaveChunk(bNil, 4 - dwFiller) size diff --git a/src/Compiler/AbstractIL/ilsupp.fsi b/src/Compiler/AbstractIL/ilsupp.fsi index a7b9ddefcfe..e0aa2785471 100644 --- a/src/Compiler/AbstractIL/ilsupp.fsi +++ b/src/Compiler/AbstractIL/ilsupp.fsi @@ -48,14 +48,14 @@ type PdbDebugPoint = pdbSeqPointEndLine: int pdbSeqPointEndColumn: int } -val pdbReadOpen: string (* module *) -> string (* path *) -> PdbReader +val pdbReadOpen: string (* module *) -> string (* path *) -> PdbReader val pdbReadClose: PdbReader -> unit -val pdbReaderGetMethod: PdbReader -> int32 (* token *) -> PdbMethod -val pdbReaderGetMethodFromDocumentPosition: PdbReader -> PdbDocument -> int (* line *) -> int (* col *) -> PdbMethod +val pdbReaderGetMethod: PdbReader -> int32 (* token *) -> PdbMethod +val pdbReaderGetMethodFromDocumentPosition: PdbReader -> PdbDocument -> int (* line *) -> int (* col *) -> PdbMethod val pdbReaderGetDocuments: PdbReader -> PdbDocument array val pdbReaderGetDocument: - PdbReader -> string (* url *) -> byte (* guid *) [] -> byte (* guid *) [] -> byte (* guid *) [] -> PdbDocument + PdbReader -> string (* url *) -> byte (* guid *) [] -> byte (* guid *) [] -> byte (* guid *) [] -> PdbDocument val pdbDocumentGetURL: PdbDocument -> string val pdbDocumentGetType: PdbDocument -> byte (* guid *) [] @@ -72,7 +72,7 @@ val pdbScopeGetLocals: PdbMethodScope -> PdbVariable array val pdbVariableGetName: PdbVariable -> string val pdbVariableGetSignature: PdbVariable -> byte[] -val pdbVariableGetAddressAttributes: PdbVariable -> int32 (* kind *) * int32 (* addrField1 *) +val pdbVariableGetAddressAttributes: PdbVariable -> int32 (* kind *) * int32 (* addrField1 *) #endif #if !FX_NO_PDB_WRITER @@ -89,7 +89,7 @@ type idd = iddType: int32 iddData: byte[] } -val pdbInitialize: string (* .exe/.dll already written and closed *) -> string (* .pdb to write *) -> PdbWriter +val pdbInitialize: string (* .exe/.dll already written and closed *) -> string (* .pdb to write *) -> PdbWriter val pdbClose: PdbWriter -> string -> string -> unit val pdbCloseDocument: PdbDocumentWriter -> unit val pdbSetUserEntryPoint: PdbWriter -> int32 -> unit diff --git a/src/Compiler/AbstractIL/ilwritepdb.fs b/src/Compiler/AbstractIL/ilwritepdb.fs index c81cfc23ad3..55b23795bbc 100644 --- a/src/Compiler/AbstractIL/ilwritepdb.fs +++ b/src/Compiler/AbstractIL/ilwritepdb.fs @@ -751,10 +751,12 @@ type PortablePdbGenerator builder.WriteCompressedInteger offsetDelta // Check for hidden-sequence-point-record - if startLine = 0xfeefee - || endLine = 0xfeefee - || (startColumn = 0 && endColumn = 0) - || ((endLine - startLine) = 0 && (endColumn - startColumn) = 0) then + if + startLine = 0xfeefee + || endLine = 0xfeefee + || (startColumn = 0 && endColumn = 0) + || ((endLine - startLine) = 0 && (endColumn - startColumn) = 0) + then // Hidden-sequence-point-record builder.WriteCompressedInteger 0 builder.WriteCompressedInteger 0 @@ -1008,14 +1010,16 @@ let writePdbInfo showTimes outfile pdbfile info cvChunk = | Some p -> sco.StartOffset <> p.StartOffset || sco.EndOffset <> p.EndOffset | None -> true - if nested then pdbOpenScope pdbw sco.StartOffset + if nested then + pdbOpenScope pdbw sco.StartOffset sco.Locals |> Array.iter (fun v -> pdbDefineLocalVariable pdbw v.Name v.Signature v.Index) sco.Children |> Array.iter (writePdbScope (if nested then Some sco else parent)) - if nested then pdbCloseScope pdbw sco.EndOffset) + if nested then + pdbCloseScope pdbw sco.EndOffset) match minfo.RootScope with | None -> () @@ -1242,8 +1246,10 @@ and allNamesOfScopes acc (scopes: PdbMethodScope[]) = let rec pushShadowedLocals (stackGuard: StackGuard) (localsToPush: PdbLocalVar[]) (scope: PdbMethodScope) = stackGuard.Guard(fun () -> // Check if child scopes are properly nested - if scope.Children - |> Array.forall (fun child -> child.StartOffset >= scope.StartOffset && child.EndOffset <= scope.EndOffset) then + if + scope.Children + |> Array.forall (fun child -> child.StartOffset >= scope.StartOffset && child.EndOffset <= scope.EndOffset) + then let children = scope.Children |> Array.sortWith scopeSorter diff --git a/src/Compiler/AbstractIL/ilx.fs b/src/Compiler/AbstractIL/ilx.fs index 6a7adab880b..4eb18649752 100644 --- a/src/Compiler/AbstractIL/ilx.fs +++ b/src/Compiler/AbstractIL/ilx.fs @@ -39,7 +39,7 @@ type IlxUnionHasHelpers = | SpecialFSharpListHelpers | SpecialFSharpOptionHelpers -type IlxUnionRef = IlxUnionRef of boxity: ILBoxity * ILTypeRef * IlxUnionCase[] * bool (* hasHelpers: *) * IlxUnionHasHelpers +type IlxUnionRef = IlxUnionRef of boxity: ILBoxity * ILTypeRef * IlxUnionCase[] * bool (* hasHelpers: *) * IlxUnionHasHelpers type IlxUnionSpec = | IlxUnionSpec of IlxUnionRef * ILGenericArgs diff --git a/src/Compiler/AbstractIL/ilx.fsi b/src/Compiler/AbstractIL/ilx.fsi index 901117867b7..a6a008434be 100644 --- a/src/Compiler/AbstractIL/ilx.fsi +++ b/src/Compiler/AbstractIL/ilx.fsi @@ -39,7 +39,7 @@ type IlxUnionRef = boxity: ILBoxity * ILTypeRef * IlxUnionCase[] * - bool (* IsNullPermitted *) * + bool (* IsNullPermitted *) * IlxUnionHasHelpers (* HasHelpers *) type IlxUnionSpec = diff --git a/src/Compiler/Checking/CheckExpressions.fs b/src/Compiler/Checking/CheckExpressions.fs index 0de950283e7..d513a326a74 100644 --- a/src/Compiler/Checking/CheckExpressions.fs +++ b/src/Compiler/Checking/CheckExpressions.fs @@ -578,6 +578,7 @@ type ValScheme = id: Ident * typeScheme: GeneralizedType * valReprInfo: ValReprInfo option * + valReprInfoForDisplay: ValReprInfo option * memberInfo: PrelimMemberInfo option * isMutable: bool * inlineInfo: ValInline * @@ -1500,7 +1501,7 @@ let MakeAndPublishVal (cenv: cenv) env (altActualParent, inSig, declKind, valRec let g = cenv.g - let (ValScheme(id, typeScheme, valReprInfo, memberInfoOpt, isMutable, inlineFlag, baseOrThis, vis, isCompGen, isIncrClass, isTyFunc, hasDeclaredTypars)) = vscheme + let (ValScheme(id, typeScheme, valReprInfo, valReprInfoForDisplay, memberInfoOpt, isMutable, inlineFlag, baseOrThis, vis, isCompGen, isIncrClass, isTyFunc, hasDeclaredTypars)) = vscheme let ty = GeneralizedTypeForTypeScheme typeScheme @@ -1608,6 +1609,10 @@ let MakeAndPublishVal (cenv: cenv) env (altActualParent, inSig, declKind, valRec xmlDoc, isTopBinding, isExtrinsic, isIncrClass, isTyFunc, (hasDeclaredTypars || inSig), isGeneratedEventVal, konst, actualParent) + match valReprInfoForDisplay with + | Some info when not (ValReprInfo.IsEmpty info) -> + vspec.SetValReprInfoForDisplay valReprInfoForDisplay + | _ -> () CheckForAbnormalOperatorNames cenv id.idRange vspec.DisplayNameCoreMangled memberInfoOpt @@ -1641,10 +1646,11 @@ let MakeAndPublishVals cenv env (altActualParent, inSig, declKind, valRecInfo, v valSchemes Map.empty +/// Create a Val node for "base" in a class let MakeAndPublishBaseVal cenv env baseIdOpt ty = baseIdOpt |> Option.map (fun (id: Ident) -> - let valscheme = ValScheme(id, NonGenericTypeScheme ty, None, None, false, ValInline.Never, BaseVal, None, false, false, false, false) + let valscheme = ValScheme(id, NonGenericTypeScheme ty, None, None, None, false, ValInline.Never, BaseVal, None, false, false, false, false) MakeAndPublishVal cenv env (ParentNone, false, ExpressionBinding, ValNotInRecScope, valscheme, [], XmlDoc.Empty, None, false)) // Make the "delayed reference" value where the this pointer will reside after calling the base class constructor @@ -1657,7 +1663,7 @@ let MakeAndPublishSafeThisVal (cenv: cenv) env (thisIdOpt: Ident option) thisTy if not (isFSharpObjModelTy g thisTy) then errorR(Error(FSComp.SR.tcStructsCanOnlyBindThisAtMemberDeclaration(), thisId.idRange)) - let valScheme = ValScheme(thisId, NonGenericTypeScheme(mkRefCellTy g thisTy), None, None, false, ValInline.Never, CtorThisVal, None, false, false, false, false) + let valScheme = ValScheme(thisId, NonGenericTypeScheme(mkRefCellTy g thisTy), None, None, None, false, ValInline.Never, CtorThisVal, None, false, false, false, false) Some(MakeAndPublishVal cenv env (ParentNone, false, ExpressionBinding, ValNotInRecScope, valScheme, [], XmlDoc.Empty, None, false)) | None -> @@ -1742,11 +1748,11 @@ let ChooseCanonicalDeclaredTyparsAfterInference g denv declaredTypars m = declaredTypars let ChooseCanonicalValSchemeAfterInference g denv vscheme m = - let (ValScheme(id, typeScheme, arityInfo, memberInfoOpt, isMutable, inlineFlag, baseOrThis, vis, isCompGen, isIncrClass, isTyFunc, hasDeclaredTypars)) = vscheme + let (ValScheme(id, typeScheme, valReprInfo, valReprInfoForDisplay, memberInfoOpt, isMutable, inlineFlag, baseOrThis, vis, isCompGen, isIncrClass, isTyFunc, hasDeclaredTypars)) = vscheme let (GeneralizedType(generalizedTypars, ty)) = typeScheme let generalizedTypars = ChooseCanonicalDeclaredTyparsAfterInference g denv generalizedTypars m let typeScheme = GeneralizedType(generalizedTypars, ty) - let valscheme = ValScheme(id, typeScheme, arityInfo, memberInfoOpt, isMutable, inlineFlag, baseOrThis, vis, isCompGen, isIncrClass, isTyFunc, hasDeclaredTypars) + let valscheme = ValScheme(id, typeScheme, valReprInfo, valReprInfoForDisplay, memberInfoOpt, isMutable, inlineFlag, baseOrThis, vis, isCompGen, isIncrClass, isTyFunc, hasDeclaredTypars) valscheme let PlaceTyparsInDeclarationOrder declaredTypars generalizedTypars = @@ -1817,10 +1823,11 @@ let ComputeIsTyFunc(id: Ident, hasDeclaredTypars, arityInfo: ValReprInfo option) | Some info -> info.NumCurriedArgs = 0) let UseSyntacticArity declKind typeScheme prelimValReprInfo = + let valReprInfo = InferGenericArityFromTyScheme typeScheme prelimValReprInfo if DeclKind.MustHaveArity declKind then - Some(InferGenericArityFromTyScheme typeScheme prelimValReprInfo) + Some valReprInfo, None else - None + None, Some valReprInfo /// Combine the results of InferSynValData and InferArityOfExpr. // @@ -1855,18 +1862,17 @@ let UseSyntacticArity declKind typeScheme prelimValReprInfo = // { new Base with // member x.M(v: unit) = () } // -let CombineSyntacticAndInferredArities g declKind rhsExpr prelimScheme = +let CombineSyntacticAndInferredArities g rhsExpr prelimScheme = let (PrelimVal2(_, typeScheme, partialValReprInfoOpt, memberInfoOpt, isMutable, _, _, ArgAndRetAttribs(argAttribs, retAttribs), _, _, _)) = prelimScheme - match partialValReprInfoOpt, DeclKind.MustHaveArity declKind with - | _, false -> None - | None, true -> Some(PrelimValReprInfo([], ValReprInfo.unnamedRetVal)) + match partialValReprInfoOpt with + | None -> Some(PrelimValReprInfo([], ValReprInfo.unnamedRetVal)) // Don't use any expression information for members, where syntax dictates the arity completely | _ when memberInfoOpt.IsSome -> partialValReprInfoOpt // Don't use any expression information for 'let' bindings where return attributes are present | _ when retAttribs.Length > 0 -> partialValReprInfoOpt - | Some partialValReprInfoFromSyntax, true -> + | Some partialValReprInfoFromSyntax -> let (PrelimValReprInfo(curriedArgInfosFromSyntax, retInfoFromSyntax)) = partialValReprInfoFromSyntax let partialArityInfo = if isMutable then @@ -1899,16 +1905,20 @@ let CombineSyntacticAndInferredArities g declKind rhsExpr prelimScheme = let BuildValScheme declKind partialArityInfoOpt prelimScheme = let (PrelimVal2(id, typeScheme, _, memberInfoOpt, isMutable, inlineFlag, baseOrThis, _, vis, isCompGen, hasDeclaredTypars)) = prelimScheme - let valReprInfo = + let valReprInfoOpt = + partialArityInfoOpt + |> Option.map (InferGenericArityFromTyScheme typeScheme) + + let valReprInfo, valReprInfoForDisplay = if DeclKind.MustHaveArity declKind then - Option.map (InferGenericArityFromTyScheme typeScheme) partialArityInfoOpt + valReprInfoOpt, None else - None + None, valReprInfoOpt let isTyFunc = ComputeIsTyFunc(id, hasDeclaredTypars, valReprInfo) - ValScheme(id, typeScheme, valReprInfo, memberInfoOpt, isMutable, inlineFlag, baseOrThis, vis, isCompGen, false, isTyFunc, hasDeclaredTypars) + ValScheme(id, typeScheme, valReprInfo, valReprInfoForDisplay, memberInfoOpt, isMutable, inlineFlag, baseOrThis, vis, isCompGen, false, isTyFunc, hasDeclaredTypars) let UseCombinedArity g declKind rhsExpr prelimScheme = - let partialArityInfoOpt = CombineSyntacticAndInferredArities g declKind rhsExpr prelimScheme + let partialArityInfoOpt = CombineSyntacticAndInferredArities g rhsExpr prelimScheme BuildValScheme declKind partialArityInfoOpt prelimScheme let UseNoArity prelimScheme = @@ -10229,7 +10239,7 @@ and TcNormalizedBinding declKind (cenv: cenv) env tpenv overallTy safeThisValOpt | [] -> valSynData | {Range=mHead} :: _ -> let (SynValData(valMf, SynValInfo(args, SynArgInfo(attrs, opt, retId)), valId)) = valSynData - in SynValData(valMf, SynValInfo(args, SynArgInfo({Attributes=rotRetSynAttrs; Range=mHead} :: attrs, opt, retId)), valId) + SynValData(valMf, SynValInfo(args, SynArgInfo({Attributes=rotRetSynAttrs; Range=mHead} :: attrs, opt, retId)), valId) retAttribs, valAttribs, valSynData let isVolatile = HasFSharpAttribute g g.attrib_VolatileFieldAttribute valAttribs @@ -10779,7 +10789,7 @@ and TcLetBinding cenv isUse env containerInfo declKind tpenv (synBinds, synBinds // If the overall declaration is declaring statics or a module value, then force the patternInputTmp to also // have representation as module value. - if (DeclKind.MustHaveArity declKind) then + if DeclKind.MustHaveArity declKind then AdjustValToTopVal tmp altActualParent (InferArityOfExprBinding g AllowTypeDirectedDetupling.Yes tmp rhsExpr) tmp, checkedPat @@ -11355,9 +11365,9 @@ and AnalyzeAndMakeAndPublishRecursiveValue // NOTE: top arity, type and typars get fixed-up after inference let prelimTyscheme = GeneralizedType(enclosingDeclaredTypars@declaredTypars, ty) let prelimValReprInfo = TranslateSynValInfo mBinding (TcAttributes cenv envinner) valSynInfo - let valReprInfo = UseSyntacticArity declKind prelimTyscheme prelimValReprInfo + let valReprInfo, valReprInfoForDisplay = UseSyntacticArity declKind prelimTyscheme prelimValReprInfo let hasDeclaredTypars = not (List.isEmpty declaredTypars) - let prelimValScheme = ValScheme(bindingId, prelimTyscheme, valReprInfo, memberInfoOpt, false, inlineFlag, NormalVal, vis, false, false, false, hasDeclaredTypars) + let prelimValScheme = ValScheme(bindingId, prelimTyscheme, valReprInfo, valReprInfoForDisplay, memberInfoOpt, false, inlineFlag, NormalVal, vis, false, false, false, hasDeclaredTypars) // Check the literal r.h.s., if any let _, literalValue = TcLiteral cenv ty envinner tpenv (bindingAttribs, bindingExpr) diff --git a/src/Compiler/Checking/CheckExpressions.fsi b/src/Compiler/Checking/CheckExpressions.fsi index 831a4cf9b20..8b5f1878532 100644 --- a/src/Compiler/Checking/CheckExpressions.fsi +++ b/src/Compiler/Checking/CheckExpressions.fsi @@ -584,12 +584,13 @@ type RecursiveBindingInfo = [] type CheckedBindingInfo -/// Represnts the results of the second phase of checking simple values +/// Represents the results of the second phase of checking simple values type ValScheme = | ValScheme of id: Ident * typeScheme: GeneralizedType * valReprInfo: ValReprInfo option * + valReprInfoForDisplay: ValReprInfo option * memberInfo: PrelimMemberInfo option * isMutable: bool * inlineInfo: ValInline * diff --git a/src/Compiler/Checking/CheckIncrementalClasses.fs b/src/Compiler/Checking/CheckIncrementalClasses.fs index f4371e3c925..f225a9927e8 100644 --- a/src/Compiler/Checking/CheckIncrementalClasses.fs +++ b/src/Compiler/Checking/CheckIncrementalClasses.fs @@ -133,7 +133,7 @@ let TcImplicitCtorLhs_Phase2A(cenv: cenv, env, tpenv, tcref: TyconRef, vis, attr let prelimTyschemeG = GeneralizedType(copyOfTyconTypars, ctorTy) let isComplete = ComputeIsComplete copyOfTyconTypars [] ctorTy let varReprInfo = InferGenericArityFromTyScheme prelimTyschemeG prelimValReprInfo - let ctorValScheme = ValScheme(id, prelimTyschemeG, Some varReprInfo, Some memberInfo, false, ValInline.Never, NormalVal, vis, false, true, false, false) + let ctorValScheme = ValScheme(id, prelimTyschemeG, Some varReprInfo, None, Some memberInfo, false, ValInline.Never, NormalVal, vis, false, true, false, false) let paramNames = varReprInfo.ArgNames let xmlDoc = xmlDoc.ToXmlDoc(true, Some paramNames) let ctorVal = MakeAndPublishVal cenv env (Parent tcref, false, ModuleOrMemberBinding, ValInRecScope isComplete, ctorValScheme, attribs, xmlDoc, None, false) @@ -154,7 +154,7 @@ let TcImplicitCtorLhs_Phase2A(cenv: cenv, env, tpenv, tcref: TyconRef, vis, attr let prelimValReprInfo = TranslateSynValInfo m (TcAttributes cenv env) valSynData let prelimTyschemeG = GeneralizedType(copyOfTyconTypars, cctorTy) let valReprInfo = InferGenericArityFromTyScheme prelimTyschemeG prelimValReprInfo - let cctorValScheme = ValScheme(id, prelimTyschemeG, Some valReprInfo, Some memberInfo, false, ValInline.Never, NormalVal, Some (SynAccess.Private Range.Zero), false, true, false, false) + let cctorValScheme = ValScheme(id, prelimTyschemeG, Some valReprInfo, None, Some memberInfo, false, ValInline.Never, NormalVal, Some (SynAccess.Private Range.Zero), false, true, false, false) let cctorVal = MakeAndPublishVal cenv env (Parent tcref, false, ModuleOrMemberBinding, ValNotInRecScope, cctorValScheme, [(* no attributes*)], XmlDoc.Empty, None, false) cctorArgs, cctorVal, cctorValScheme @@ -162,7 +162,7 @@ let TcImplicitCtorLhs_Phase2A(cenv: cenv, env, tpenv, tcref: TyconRef, vis, attr let thisVal = // --- Create this for use inside constructor let thisId = ident ("this", m) - let thisValScheme = ValScheme(thisId, NonGenericTypeScheme thisTy, None, None, false, ValInline.Never, CtorThisVal, None, true, false, false, false) + let thisValScheme = ValScheme(thisId, NonGenericTypeScheme thisTy, None, None, None, false, ValInline.Never, CtorThisVal, None, true, false, false, false) let thisVal = MakeAndPublishVal cenv env (ParentNone, false, ClassLetBinding false, ValNotInRecScope, thisValScheme, [], XmlDoc.Empty, None, false) thisVal @@ -350,7 +350,7 @@ type IncrClassReprInfo = // NOTE: putting isCompilerGenerated=true here is strange. The method is not public, nor is // it a "member" in the F# sense, but the F# spec says it is generated and it is reasonable to reflect on it. - let memberValScheme = ValScheme(id, prelimTyschemeG, Some valReprInfo, Some memberInfo, false, ValInline.Never, NormalVal, None, true (* isCompilerGenerated *), true (* isIncrClass *), false, false) + let memberValScheme = ValScheme(id, prelimTyschemeG, Some valReprInfo, None, Some memberInfo, false, ValInline.Never, NormalVal, None, true (* isCompilerGenerated *), true (* isIncrClass *), false, false) let methodVal = MakeAndPublishVal cenv env (Parent tcref, false, ModuleOrMemberBinding, ValNotInRecScope, memberValScheme, v.Attribs, XmlDoc.Empty, None, false) diff --git a/src/Compiler/Checking/NicePrint.fs b/src/Compiler/Checking/NicePrint.fs index 3a398620de9..6d8b38c7956 100644 --- a/src/Compiler/Checking/NicePrint.fs +++ b/src/Compiler/Checking/NicePrint.fs @@ -1270,7 +1270,8 @@ module PrintTastMemberOrVals = let layoutNonMemberVal denv (tps, v: Val, tau, cxs) = let env = SimplifyTypes.CollectInfo true [tau] cxs let cxs = env.postfixConstraints - let argInfos, retTy = GetTopTauTypeInFSharpForm denv.g (arityOfVal v).ArgInfos tau v.Range + let valReprInfo = arityOfValForDisplay v + let argInfos, retTy = GetTopTauTypeInFSharpForm denv.g valReprInfo.ArgInfos tau v.Range let nameL = let tagF = diff --git a/src/Compiler/CodeGen/EraseClosures.fs b/src/Compiler/CodeGen/EraseClosures.fs index 6f6646177a5..5ba6c4b50a0 100644 --- a/src/Compiler/CodeGen/EraseClosures.fs +++ b/src/Compiler/CodeGen/EraseClosures.fs @@ -500,9 +500,11 @@ let rec convIlxClosureDef cenv encl (td: ILTypeDef) clo = // nb. should combine the term and type abstraction cases for // to allow for term and type variables to be mixed in a single // application. - if (match laterStruct with - | Lambdas_return _ -> false - | _ -> true) then + if + (match laterStruct with + | Lambdas_return _ -> false + | _ -> true) + then let nowStruct = List.foldBack (fun x y -> Lambdas_forall(x, y)) tyargsl (Lambdas_return nowReturnTy) @@ -622,9 +624,11 @@ let rec convIlxClosureDef cenv encl (td: ILTypeDef) clo = let nowReturnTy = mkTyOfLambdas cenv laterStruct // CASE 2a - Too Many Term Arguments or Remaining Type arguments - Split the Closure Class in Two - if (match laterStruct with - | Lambdas_return _ -> false - | _ -> true) then + if + (match laterStruct with + | Lambdas_return _ -> false + | _ -> true) + then let nowStruct = List.foldBack (fun l r -> Lambdas_lambda(l, r)) nowParams (Lambdas_return nowReturnTy) diff --git a/src/Compiler/CodeGen/EraseUnions.fs b/src/Compiler/CodeGen/EraseUnions.fs index 1e4b3c1f591..626ddd49758 100644 --- a/src/Compiler/CodeGen/EraseUnions.fs +++ b/src/Compiler/CodeGen/EraseUnions.fs @@ -76,7 +76,8 @@ type UnionReprDecisions<'Union, 'Alt, 'Type> if alts.Length = 1 then SingleCase elif - not (isStruct cu) && alts.Length < TaggingThresholdFixedConstant + not (isStruct cu) + && alts.Length < TaggingThresholdFixedConstant && not (repr.RepresentAllAlternativesAsConstantFieldsInRootClass cu) then RuntimeTypes @@ -1280,12 +1281,14 @@ let mkClassUnionDef ] let ctorMeths = - if (List.isEmpty selfFields - && List.isEmpty tagFieldsInObject - && not (List.isEmpty selfMeths)) - || isStruct - || cud.UnionCases - |> Array.forall (fun alt -> repr.RepresentAlternativeAsFreshInstancesOfRootClass(info, alt)) then + if + (List.isEmpty selfFields + && List.isEmpty tagFieldsInObject + && not (List.isEmpty selfMeths)) + || isStruct + || cud.UnionCases + |> Array.forall (fun alt -> repr.RepresentAlternativeAsFreshInstancesOfRootClass(info, alt)) + then [] (* no need for a second ctor in these cases *) diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 1bf87805a0b..c39508fc595 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -210,7 +210,11 @@ let ReportStatistics (oc: TextWriter) = reports oc let NewCounter nm = let mutable count = 0 - AddReport(fun oc -> if count <> 0 then oc.WriteLine(string count + " " + nm)) + + AddReport(fun oc -> + if count <> 0 then + oc.WriteLine(string count + " " + nm)) + (fun () -> count <- count + 1) let CountClosure = NewCounter "closures" @@ -653,9 +657,11 @@ and GenNamedTyAppAux (cenv: cenv) m (tyenv: TypeReprEnv) ptrsOK tcref tinst = | _ -> let tinst = DropErasedTyargs tinst // See above note on ptrsOK - if ptrsOK = PtrTypesOK - && tyconRefEq g tcref g.nativeptr_tcr - && (freeInTypes CollectTypars tinst).FreeTypars.IsEmpty then + if + ptrsOK = PtrTypesOK + && tyconRefEq g tcref g.nativeptr_tcr + && (freeInTypes CollectTypars tinst).FreeTypars.IsEmpty + then GenNamedTyAppAux cenv m tyenv ptrsOK g.ilsigptr_tcr tinst else #if !NO_TYPEPROVIDERS @@ -1910,7 +1916,8 @@ type TypeDefBuilder(tdef: ILTypeDef, tdefDiscards) = | Some (mdefDiscard, _) -> mdefDiscard ilMethodDef | None -> false - if not discard then gmethods.Add ilMethodDef + if not discard then + gmethods.Add ilMethodDef member _.NestedTypeDefs = gnested @@ -1924,7 +1931,8 @@ type TypeDefBuilder(tdef: ILTypeDef, tdefDiscards) = | Some (_, pdefDiscard) -> pdefDiscard pdef | None -> false - if not discard then AddPropertyDefToHash m gproperties pdef + if not discard then + AddPropertyDefToHash m gproperties pdef member _.PrependInstructionsToSpecificMethodDef(cond, instrs, tag, imports) = match ResizeArray.tryFindIndex cond gmethods with @@ -2138,7 +2146,8 @@ type AssemblyBuilder(cenv: cenv, anonTypeTable: AnonTypeGenerationTable) as mgbu lmtyp ) - if isStruct then tycon.SetIsStructRecordOrUnion true + if isStruct then + tycon.SetIsStructRecordOrUnion true tycon.entity_tycon_repr <- TFSharpRecdRepr( @@ -2470,10 +2479,12 @@ type CodeGenBuffer(m: range, mgbuf: AssemblyBuilder, methodName, alreadyUsedArgs member private _.EnsureNopBetweenDebugPoints() = // Always add a nop between debug points to help .NET get the stepping right // Don't do this after a FeeFee marker for hidden code - if (codebuf.Count > 0 - && (match codebuf[codebuf.Count - 1] with - | I_seqpoint sm when sm.Line <> FeeFee mgbuf.cenv -> true - | _ -> false)) then + if + (codebuf.Count > 0 + && (match codebuf[codebuf.Count - 1] with + | I_seqpoint sm when sm.Line <> FeeFee mgbuf.cenv -> true + | _ -> false)) + then codebuf.Add(AI_nop) @@ -2599,11 +2610,13 @@ type CodeGenBuffer(m: range, mgbuf: AssemblyBuilder, methodName, alreadyUsedArgs let instrs = instrs |> Array.mapi (fun idx i2 -> - if idx = 0 - && (match i2 with - | AI_nop -> true - | _ -> false) - && anyDocument.IsSome then + if + idx = 0 + && (match i2 with + | AI_nop -> true + | _ -> false) + && anyDocument.IsSome + then // This special dummy debug point says skip the start of the method hasDebugPoints <- true FeeFeeInstr mgbuf.cenv anyDocument.Value @@ -2842,7 +2855,8 @@ and GenExprPreSteps (cenv: cenv) (cgbuf: CodeGenBuffer) eenv expr sequel = let others = [ for k in cenv.namedDebugPointsForInlinedCode.Keys do - if Range.equals m k.Range then yield k.Name + if Range.equals m k.Range then + yield k.Name ] |> String.concat "," @@ -3553,9 +3567,11 @@ and GenNewArray cenv cgbuf eenv (elems: Expr list, elemTy, m) sequel = // InitializeArray is a JIT intrinsic that will result in invalid runtime CodeGen when initializing an array // of enum types. Until bug 872799 is fixed, we'll need to generate arrays the "simple" way for enum types // Also note - C# never uses InitializeArray for enum types, so this change puts us on equal footing with them. - if elems.Length <= 5 - || not cenv.options.emitConstantArraysUsingStaticDataBlobs - || (isEnumTy cenv.g elemTy) then + if + elems.Length <= 5 + || not cenv.options.emitConstantArraysUsingStaticDataBlobs + || (isEnumTy cenv.g elemTy) + then GenNewArraySimple cenv cgbuf eenv (elems, elemTy, m) sequel else // Try to emit a constant byte-blob array @@ -3648,10 +3664,12 @@ and GenNewArray cenv cgbuf eenv (elems: Expr list, elemTy, m) sequel = | _ -> false), (fun _ _ -> failwith "unreachable") - if elemsArray - |> Array.forall (function - | Expr.Const (c, _, _) -> test c - | _ -> false) then + if + elemsArray + |> Array.forall (function + | Expr.Const (c, _, _) -> test c + | _ -> false) + then let ilElemTy = GenType cenv m eenv.tyenv elemTy GenConstArray cenv cgbuf eenv ilElemTy elemsArray (fun buf -> @@ -3667,10 +3685,12 @@ and GenNewArray cenv cgbuf eenv (elems: Expr list, elemTy, m) sequel = and GenCoerce cenv cgbuf eenv (e, tgty, m, srcty) sequel = let g = cenv.g // Is this an upcast? - if TypeDefinitelySubsumesTypeNoCoercion 0 g cenv.amap m tgty srcty - && - // Do an extra check - should not be needed - TypeFeasiblySubsumesType 0 g cenv.amap m tgty NoCoerce srcty then + if + TypeDefinitelySubsumesTypeNoCoercion 0 g cenv.amap m tgty srcty + && + // Do an extra check - should not be needed + TypeFeasiblySubsumesType 0 g cenv.amap m tgty NoCoerce srcty + then if isInterfaceTy g tgty then GenExpr cenv cgbuf eenv e Continue let ilToTy = GenType cenv m eenv.tyenv tgty @@ -3838,8 +3858,10 @@ and GenFieldGet isStatic cenv cgbuf eenv (rfref: RecdFieldRef, tyargs, m) = let fspec = GenRecdFieldRef m cenv eenv.tyenv rfref tyargs let vol = if rfref.RecdField.IsVolatile then Volatile else Nonvolatile - if useGenuineField rfref.Tycon rfref.RecdField - || entityRefInThisAssembly cenv.g.compilingFSharpCore rfref.TyconRef then + if + useGenuineField rfref.Tycon rfref.RecdField + || entityRefInThisAssembly cenv.g.compilingFSharpCore rfref.TyconRef + then let instr = if isStatic then I_ldsfld(vol, fspec) @@ -4306,9 +4328,11 @@ and GenApp (cenv: cenv) cgbuf eenv (f, fty, tyargs, curriedArgs, m) sequel = // When generating debug code, generate a 'nop' after a 'call' that returns 'void' // This is what C# does, as it allows the call location to be maintained correctly in the stack frame - if cenv.options.generateDebugSymbols - && mustGenerateUnitAfterCall - && (isTailCall = Normalcall) then + if + cenv.options.generateDebugSymbols + && mustGenerateUnitAfterCall + && (isTailCall = Normalcall) + then CG.EmitInstr cgbuf (pop 0) Push0 AI_nop if isNil laterArgs then @@ -4352,22 +4376,24 @@ and CanTailcall // Can't tailcall with a struct object arg since it involves a byref // Can't tailcall with a .NET 2.0 generic constrained call since it involves a byref - if not hasStructObjArg - && Option.isNone ccallInfo - && not withinSEH - && not hasByrefArg - && not isDllImport - && not isSelfInit - && not makesNoCriticalTailcalls - && - - // We can tailcall even if we need to generate "unit", as long as we're about to throw the value away anyway as par of the return. - // We can tailcall if we don't need to generate "unit", as long as we're about to return. - (match sequelIgnoreEndScopes sequel with - | ReturnVoid - | Return -> not mustGenerateUnitAfterCall - | DiscardThen ReturnVoid -> mustGenerateUnitAfterCall - | _ -> false) then + if + not hasStructObjArg + && Option.isNone ccallInfo + && not withinSEH + && not hasByrefArg + && not isDllImport + && not isSelfInit + && not makesNoCriticalTailcalls + && + + // We can tailcall even if we need to generate "unit", as long as we're about to throw the value away anyway as par of the return. + // We can tailcall if we don't need to generate "unit", as long as we're about to return. + (match sequelIgnoreEndScopes sequel with + | ReturnVoid + | Return -> not mustGenerateUnitAfterCall + | DiscardThen ReturnVoid -> mustGenerateUnitAfterCall + | _ -> false) + then Tailcall else Normalcall @@ -5562,9 +5588,11 @@ and GenGenericParam cenv eenv (tp: Typar) = | _ -> if nm.TrimEnd([| '0' .. '9' |]).Length = 1 then nm - elif nm.Length >= 1 - && nm[0] = 'T' - && (nm.Length = 1 || not (System.Char.IsLower nm[1])) then + elif + nm.Length >= 1 + && nm[0] = 'T' + && (nm.Length = 1 || not (System.Char.IsLower nm[1])) + then nm else "T" + (String.capitalize nm) @@ -5874,14 +5902,13 @@ and GenStructStateMachine cenv cgbuf eenvouter (res: LoweredStateMachine) sequel let finfo = match - infoReader.GetRecordOrClassFieldsOfType - ( - Some fieldName, - AccessibilityLogic.AccessorDomain.AccessibleFromSomewhere, - m, - templateStructTy - ) - with + infoReader.GetRecordOrClassFieldsOfType( + Some fieldName, + AccessibilityLogic.AccessorDomain.AccessibleFromSomewhere, + m, + templateStructTy + ) + with | [ finfo ] -> finfo | _ -> error (InternalError(sprintf "expected class field %s not found" fieldName, m)) @@ -5894,14 +5921,13 @@ and GenStructStateMachine cenv cgbuf eenvouter (res: LoweredStateMachine) sequel let finfo = match - infoReader.GetRecordOrClassFieldsOfType - ( - Some fieldName, - AccessibilityLogic.AccessorDomain.AccessibleFromSomewhere, - m, - templateStructTy - ) - with + infoReader.GetRecordOrClassFieldsOfType( + Some fieldName, + AccessibilityLogic.AccessorDomain.AccessibleFromSomewhere, + m, + templateStructTy + ) + with | [ finfo ] -> finfo | _ -> error (InternalError(sprintf "expected class field %s not found" fieldName, m)) @@ -5939,7 +5965,7 @@ and GenStructStateMachine cenv cgbuf eenvouter (res: LoweredStateMachine) sequel AccessibilityLogic.AccessorDomain.AccessibleFromSomewhere imethName interfaceTy - with + with | [ meth ] when meth.IsInstance -> meth | _ -> error (InternalError(sprintf "expected method %s not found" imethName, m)) @@ -5989,7 +6015,7 @@ and GenStructStateMachine cenv cgbuf eenvouter (res: LoweredStateMachine) sequel AccessibilityLogic.AccessorDomain.AccessibleFromSomewhere imethName interfaceTy - with + with | [ meth ] when meth.IsInstance -> meth | _ -> error (InternalError(sprintf "expected method %s not found" imethName, m)) @@ -8093,9 +8119,11 @@ and GenBindingAfterDebugPoint cenv cgbuf eenv bind isStateVar startMarkOpt = // Workaround for .NET and Visual Studio restriction w.r.t debugger type proxys // Mark internal constructors in internal classes as public. let access = - if access = ILMemberAccess.Assembly - && vspec.IsConstructor - && IsHiddenTycon eenv.sigToImplRemapInfo vspec.MemberApparentEntity.Deref then + if + access = ILMemberAccess.Assembly + && vspec.IsConstructor + && IsHiddenTycon eenv.sigToImplRemapInfo vspec.MemberApparentEntity.Deref + then ILMemberAccess.Public else access @@ -8488,8 +8516,10 @@ and GenMarshal cenv attribs = match decoder.FindTypeName "SafeArrayUserDefinedSubType" "" with | "" -> None | res -> - if (safeArraySubType = ILNativeVariant.IDispatch) - || (safeArraySubType = ILNativeVariant.IUnknown) then + if + (safeArraySubType = ILNativeVariant.IDispatch) + || (safeArraySubType = ILNativeVariant.IUnknown) + then Some res else None @@ -8856,8 +8886,10 @@ and GenMethodForBinding |> AddStorageForLocalVals cenv.g (List.mapi (fun i v -> (v, Arg(numArgsUsed + i))) nonUnitNonSelfMethodVars) let eenvForMeth = - if eenvForMeth.initLocals - && HasFSharpAttribute g g.attrib_SkipLocalsInitAttribute v.Attribs then + if + eenvForMeth.initLocals + && HasFSharpAttribute g g.attrib_SkipLocalsInitAttribute v.Attribs + then { eenvForMeth with initLocals = false } else eenvForMeth @@ -8905,8 +8937,10 @@ and GenMethodForBinding let attr = TryFindFSharpBoolAttributeAssumeFalse cenv.g cenv.g.attrib_NoDynamicInvocationAttribute v.Attribs - if (not generateWitnessArgs && attr.IsSome) - || (generateWitnessArgs && attr = Some false) then + if + (not generateWitnessArgs && attr.IsSome) + || (generateWitnessArgs && attr = Some false) + then let exnArg = mkString cenv.g m (FSComp.SR.ilDynamicInvocationNotSupported (v.CompiledName g.CompilerGlobalState)) @@ -8939,7 +8973,7 @@ and GenMethodForBinding match v.Attribs |> List.tryFind (IsMatchingFSharpAttribute g g.attrib_CompiledNameAttribute) - with + with | Some (Attrib (_, _, [ AttribStringArg b ], _, _, _, _)) -> [ mkCompilationSourceNameAttr g v.LogicalName ], Some b | _ -> [], None @@ -9010,9 +9044,11 @@ and GenMethodForBinding -> let useMethodImpl = - if compileAsInstance - && ((memberInfo.MemberFlags.IsDispatchSlot && memberInfo.IsImplemented) - || memberInfo.MemberFlags.IsOverrideOrExplicitImpl) then + if + compileAsInstance + && ((memberInfo.MemberFlags.IsDispatchSlot && memberInfo.IsImplemented) + || memberInfo.MemberFlags.IsOverrideOrExplicitImpl) + then let useMethodImpl = ComputeUseMethodImpl cenv.g v @@ -9068,8 +9104,10 @@ and GenMethodForBinding if not compileAsInstance then mkILStaticMethod (ilMethTypars, mspec.Name, access, ilParams, ilReturn, ilMethodBody) - elif (memberInfo.MemberFlags.IsDispatchSlot && memberInfo.IsImplemented) - || memberInfo.MemberFlags.IsOverrideOrExplicitImpl then + elif + (memberInfo.MemberFlags.IsDispatchSlot && memberInfo.IsImplemented) + || memberInfo.MemberFlags.IsOverrideOrExplicitImpl + then let flagFixups = ComputeFlagFixupsForMemberBinding cenv v @@ -9197,7 +9235,8 @@ and GenMethodForBinding mdef.Name.StartsWithOrdinal("|") || // event add/remove method - v.val_flags.IsGeneratedEventVal then + v.val_flags.IsGeneratedEventVal + then mdef.WithSpecialName else mdef @@ -9763,7 +9802,8 @@ and GenTypeDefForCompLoc (cenv, eenv, mgbuf: AssemblyBuilder, cloc, hidden, attr TypeNameForImplicitMainMethod cloc TypeNameForInitClass cloc TypeNameForPrivateImplementationDetails cloc - ] then + ] + then [] else [ mkCompilationMappingAttr g (int SourceConstructFlags.Module) ]) @@ -9899,10 +9939,12 @@ and GenModuleBinding cenv (cgbuf: CodeGenBuffer) (qname: QualifiedNameOfFile) la // If the module has a .cctor for some mutable fields, we need to ensure that when // those fields are "touched" the InitClass .cctor is forced. The InitClass .cctor will // then fill in the value of the mutable fields. - if not mspec.IsNamespace - && (cgbuf.mgbuf.GetCurrentFields(TypeRefForCompLoc eenvinner.cloc) - |> Seq.isEmpty - |> not) then + if + not mspec.IsNamespace + && (cgbuf.mgbuf.GetCurrentFields(TypeRefForCompLoc eenvinner.cloc) + |> Seq.isEmpty + |> not) + then GenForceWholeFileInitializationAsPartOfCCtor cenv cgbuf.mgbuf @@ -10386,11 +10428,13 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = // HOWEVER, if the type doesn't override Object.Equals already. let augmentOverrideMethodDefs = - (if Option.isNone tycon.GeneratedCompareToValues - && Option.isNone tycon.GeneratedHashAndEqualsValues - && tycon.HasInterface g g.mk_IComparable_ty - && not (tycon.HasOverride g "Equals" [ g.obj_ty ]) - && not tycon.IsFSharpInterfaceTycon then + (if + Option.isNone tycon.GeneratedCompareToValues + && Option.isNone tycon.GeneratedHashAndEqualsValues + && tycon.HasInterface g g.mk_IComparable_ty + && not (tycon.HasOverride g "Equals" [ g.obj_ty ]) + && not tycon.IsFSharpInterfaceTycon + then [ GenEqualsOverrideCallingIComparable cenv (tcref, ilThisTy, ilThisTy) ] else []) @@ -10602,7 +10646,8 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = [ // If using a field then all the attributes go on the field // See also FSharp 1.0 Bug 4727: once we start compiling them as real mutable fields, you should not be able to target both "property" for "val mutable" fields in classes - if useGenuineField then yield! fspec.PropertyAttribs + if useGenuineField then + yield! fspec.PropertyAttribs yield! fspec.FieldAttribs ] @@ -10866,9 +10911,11 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = // FSharp 1.0 bug 1988: Explicitly setting the ComVisible(true) attribute on an F# type causes an F# record to be emitted in a way that enables mutation for COM interop scenarios // FSharp 3.0 feature: adding CLIMutable to a record type causes emit of default constructor, and all fields get property setters // Records that are value types do not create a default constructor with CLIMutable or ComVisible - if not isStructRecord - && (isCLIMutable - || (TryFindFSharpBoolAttribute g g.attrib_ComVisibleAttribute tycon.Attribs = Some true)) then + if + not isStructRecord + && (isCLIMutable + || (TryFindFSharpBoolAttribute g g.attrib_ComVisibleAttribute tycon.Attribs = Some true)) + then yield mkILSimpleStorageCtor (Some g.ilg.typ_Object.TypeSpec, ilThisTy, [], [], reprAccess, None, eenv.imports) if not (tycon.HasMember g "ToString" []) then @@ -11034,11 +11081,13 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = // All structs are sequential by default // Structs with no instance fields get size 1, pack 0 - if tycon.AllFieldsArray |> Array.exists (fun f -> not f.IsStatic) - || - // Reflection emit doesn't let us emit 'pack' and 'size' for generic structs. - // In that case we generate a dummy field instead - (cenv.options.workAroundReflectionEmitBugs && not tycon.TyparsNoRange.IsEmpty) then + if + tycon.AllFieldsArray |> Array.exists (fun f -> not f.IsStatic) + || + // Reflection emit doesn't let us emit 'pack' and 'size' for generic structs. + // In that case we generate a dummy field instead + (cenv.options.workAroundReflectionEmitBugs && not tycon.TyparsNoRange.IsEmpty) + then ILTypeDefLayout.Sequential { Size = None; Pack = None }, ILDefaultPInvokeEncoding.Ansi else ILTypeDefLayout.Sequential { Size = Some 1; Pack = Some 0us }, ILDefaultPInvokeEncoding.Ansi @@ -11103,9 +11152,11 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = let layout = if isStructTy g thisTy then - if (match ilTypeDefKind with - | ILTypeDefKind.ValueType -> true - | _ -> false) then + if + (match ilTypeDefKind with + | ILTypeDefKind.ValueType -> true + | _ -> false) + then // Structs with no instance fields get size 1, pack 0 ILTypeDefLayout.Sequential { Size = Some 1; Pack = Some 0us } else @@ -11206,9 +11257,11 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = // order in the sequential initialization of the file. // // In this case, the .cctor for this type must force the .cctor of the backing static class for the file. - if tycon.TyparsNoRange.IsEmpty - && tycon.MembersOfFSharpTyconSorted - |> List.exists (fun vref -> vref.Deref.IsClassConstructor) then + if + tycon.TyparsNoRange.IsEmpty + && tycon.MembersOfFSharpTyconSorted + |> List.exists (fun vref -> vref.Deref.IsClassConstructor) + then GenForceWholeFileInitializationAsPartOfCCtor cenv mgbuf lazyInitInfo tref eenv.imports m /// Generate the type for an F# exception declaration. diff --git a/src/Compiler/Driver/CompilerConfig.fs b/src/Compiler/Driver/CompilerConfig.fs index b1bca1b6092..2786e30e9a3 100644 --- a/src/Compiler/Driver/CompilerConfig.fs +++ b/src/Compiler/Driver/CompilerConfig.fs @@ -859,7 +859,8 @@ type TcConfigBuilder = | None -> () | Some n -> // nowarn:62 turns on mlCompatibility, e.g. shows ML compat items in intellisense menus - if n = 62 then tcConfigB.mlCompatibility <- true + if n = 62 then + tcConfigB.mlCompatibility <- true tcConfigB.diagnosticsOptions <- { tcConfigB.diagnosticsOptions with @@ -873,7 +874,8 @@ type TcConfigBuilder = | None -> () | Some n -> // warnon 62 turns on mlCompatibility, e.g. shows ML compat items in intellisense menus - if n = 62 then tcConfigB.mlCompatibility <- false + if n = 62 then + tcConfigB.mlCompatibility <- false tcConfigB.diagnosticsOptions <- { tcConfigB.diagnosticsOptions with @@ -941,11 +943,10 @@ type TcConfigBuilder = if FileSystem.IsInvalidPathShim path then warning (Error(FSComp.SR.buildInvalidAssemblyName (path), m)) elif - not - ( - tcConfigB.referencedDLLs - |> List.exists (fun ar2 -> equals m ar2.Range && path = ar2.Text) - ) + not ( + tcConfigB.referencedDLLs + |> List.exists (fun ar2 -> equals m ar2.Range && path = ar2.Text) + ) then // NOTE: We keep same paths if range is different. let projectReference = tcConfigB.projectReferences @@ -1052,9 +1053,10 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = else None - match data.referencedDLLs - |> List.filter (fun assemblyReference -> assemblyReference.SimpleAssemblyNameIs libraryName) - with + match + data.referencedDLLs + |> List.filter (fun assemblyReference -> assemblyReference.SimpleAssemblyNameIs libraryName) + with | [] -> defaultCoreLibraryReference, None | [ r ] | r :: _ -> nameOfDll r @@ -1179,7 +1181,9 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = let frameworkRootVersion = Path.Combine(frameworkRoot, targetFrameworkVersionValue) yield frameworkRootVersion let facades = Path.Combine(frameworkRootVersion, "Facades") - if FileSystem.DirectoryExistsShim facades then yield facades + + if FileSystem.DirectoryExistsShim facades then + yield facades match data.FxResolver.GetFrameworkRefsPackDirectory() with | Some path when FileSystem.DirectoryExistsShim(path) -> yield path diff --git a/src/Compiler/Driver/CompilerDiagnostics.fs b/src/Compiler/Driver/CompilerDiagnostics.fs index f8fd613b267..fba0a064091 100644 --- a/src/Compiler/Driver/CompilerDiagnostics.fs +++ b/src/Compiler/Driver/CompilerDiagnostics.fs @@ -1673,7 +1673,8 @@ let OutputPhasedErrorR (os: StringBuilder) (diagnostic: PhasedDiagnostic) (canSu | Some (cex, false) -> os.AppendString(MatchIncomplete2E().Format cex) | Some (cex, true) -> os.AppendString(MatchIncomplete3E().Format cex) - if isComp then os.AppendString(MatchIncomplete4E().Format) + if isComp then + os.AppendString(MatchIncomplete4E().Format) | PatternMatchCompilation.EnumMatchIncomplete (isComp, cexOpt, _) -> os.AppendString(EnumMatchIncomplete1E().Format) @@ -1683,7 +1684,8 @@ let OutputPhasedErrorR (os: StringBuilder) (diagnostic: PhasedDiagnostic) (canSu | Some (cex, false) -> os.AppendString(MatchIncomplete2E().Format cex) | Some (cex, true) -> os.AppendString(MatchIncomplete3E().Format cex) - if isComp then os.AppendString(MatchIncomplete4E().Format) + if isComp then + os.AppendString(MatchIncomplete4E().Format) | PatternMatchCompilation.RuleNeverMatched _ -> os.AppendString(RuleNeverMatchedE().Format) @@ -1695,7 +1697,9 @@ let OutputPhasedErrorR (os: StringBuilder) (diagnostic: PhasedDiagnostic) (canSu | ObsoleteWarning (s, _) -> os.AppendString(Obsolete1E().Format) - if s <> "" then os.AppendString(Obsolete2E().Format s) + + if s <> "" then + os.AppendString(Obsolete2E().Format s) | Experimental (s, _) -> os.AppendString(ExperimentalE().Format s) @@ -1990,7 +1994,8 @@ let CollectFormattedDiagnostics // Show prefix only for real files. Otherwise, we just want a truncated error like: // parse error FS0031: blah blah if - not (equals m range0) && not (equals m rangeStartup) + not (equals m range0) + && not (equals m rangeStartup) && not (equals m rangeCmdArgs) then let file = file.Replace("/", "\\") diff --git a/src/Compiler/Driver/CompilerImports.fs b/src/Compiler/Driver/CompilerImports.fs index 515bb1b3868..1e63aa45dd5 100644 --- a/src/Compiler/Driver/CompilerImports.fs +++ b/src/Compiler/Driver/CompilerImports.fs @@ -402,7 +402,8 @@ type TcConfig with seq { yield! tcConfig.GetSearchPathsForLibraryFiles() - if isHashRReference m then Path.GetDirectoryName(m.FileName) + if isHashRReference m then + Path.GetDirectoryName(m.FileName) } let resolved = TryResolveFileUsingPaths(searchPaths, m, nm) @@ -592,8 +593,10 @@ type TcConfig with // O(N^2) here over a small set of referenced assemblies. let IsResolved (originalName: string) = - if resultingResolutions - |> List.exists (fun resolution -> resolution.originalReference.Text = originalName) then + if + resultingResolutions + |> List.exists (fun resolution -> resolution.originalReference.Text = originalName) + then true else // MSBuild resolution may have unified the result of two duplicate references. Try to re-resolve now. @@ -615,8 +618,10 @@ type TcConfig with // If mode=Speculative, then we haven't reported any errors. // We report the error condition by returning an empty list of resolutions - if mode = ResolveAssemblyReferenceMode.Speculative - && unresolvedReferences.Length > 0 then + if + mode = ResolveAssemblyReferenceMode.Speculative + && unresolvedReferences.Length > 0 + then [], unresolved else resultingResolutions, unresolved @@ -736,7 +741,8 @@ type TcAssemblyResolutions(tcConfig: TcConfig, results: AssemblyResolution list, resolutions.Length = 1 - if found then asm + if found then + asm if tcConfig.implicitlyReferenceDotNetAssemblies then let references, _useDotNetFramework = @@ -1097,7 +1103,9 @@ and [] TcImports let mutable disposed = false // this doesn't need locking, it's only for debugging let mutable tcGlobals = None // this doesn't need locking, it's set during construction of the TcImports - let CheckDisposed () = if disposed then assert false + let CheckDisposed () = + if disposed then + assert false let dispose () = CheckDisposed() @@ -1116,8 +1124,11 @@ and [] TcImports let unsuccessful = [ for ccuThunk, func in contents do - if ccuThunk.IsUnresolvedReference then func () - if ccuThunk.IsUnresolvedReference then (ccuThunk, func) + if ccuThunk.IsUnresolvedReference then + func () + + if ccuThunk.IsUnresolvedReference then + (ccuThunk, func) ] ccuThunks <- ResizeArray unsuccessful) diff --git a/src/Compiler/Driver/CompilerOptions.fs b/src/Compiler/Driver/CompilerOptions.fs index e33e311eb86..b8fbfbe4f91 100644 --- a/src/Compiler/Driver/CompilerOptions.fs +++ b/src/Compiler/Driver/CompilerOptions.fs @@ -288,9 +288,11 @@ let ParseCompilerOptions (collectOtherArgument: string -> unit, blocks: Compiler let getSwitchOpt (opt: string) = // if opt is a switch, strip the '+' or '-' - if opt <> "--" - && opt.Length > 1 - && (opt.EndsWithOrdinal("+") || opt.EndsWithOrdinal("-")) then + if + opt <> "--" + && opt.Length > 1 + && (opt.EndsWithOrdinal("+") || opt.EndsWithOrdinal("-")) + then opt[0 .. opt.Length - 2] else opt @@ -368,7 +370,10 @@ let ParseCompilerOptions (collectOtherArgument: string -> unit, blocks: Compiler | CompilerOption (s, _, OptionString f, d, _) as compilerOption :: _ when optToken = s -> reportDeprecatedOption d let oa = getOptionArg compilerOption argString - if oa <> "" then f (getOptionArg compilerOption oa) + + if oa <> "" then + f (getOptionArg compilerOption oa) + t | CompilerOption (s, _, OptionInt f, d, _) as compilerOption :: _ when optToken = s -> reportDeprecatedOption d @@ -1234,7 +1239,9 @@ let noFrameworkFlag isFsc tcConfigB = tagNone, OptionUnit(fun () -> tcConfigB.implicitlyReferenceDotNetAssemblies <- false - if isFsc then tcConfigB.implicitlyResolveAssemblies <- false), + + if isFsc then + tcConfigB.implicitlyResolveAssemblies <- false), None, Some(FSComp.SR.optsNoframework ()) ) diff --git a/src/Compiler/Driver/CreateILModule.fs b/src/Compiler/Driver/CreateILModule.fs index 9039453478c..55ec3ad40a1 100644 --- a/src/Compiler/Driver/CreateILModule.fs +++ b/src/Compiler/Driver/CreateILModule.fs @@ -195,9 +195,10 @@ module MainModuleBuilder = "System.Runtime.Numerics" let numericsAssemblyRef = - match tcImports.GetImportedAssemblies() - |> List.tryFind (fun a -> a.FSharpViewOfMetadata.AssemblyName = refNumericsDllName) - with + match + tcImports.GetImportedAssemblies() + |> List.tryFind (fun a -> a.FSharpViewOfMetadata.AssemblyName = refNumericsDllName) + with | Some asm -> match asm.ILScopeRef with | ILScopeRef.Assembly aref -> Some aref @@ -581,10 +582,12 @@ module MainModuleBuilder = tcConfig.win32manifest // don't embed a manifest if target is not an exe, if manifest is specifically excluded, if another native resource is being included, or if running on mono - elif not (tcConfig.target.IsExe) - || not (tcConfig.includewin32manifest) - || not (tcConfig.win32res = "") - || runningOnMono then + elif + not (tcConfig.target.IsExe) + || not (tcConfig.includewin32manifest) + || not (tcConfig.win32res = "") + || runningOnMono + then "" // otherwise, include the default manifest else @@ -617,9 +620,11 @@ module MainModuleBuilder = tcConfig.target = CompilerTarget.Dll )) |] - if tcConfig.win32res = "" - && tcConfig.win32icon <> "" - && tcConfig.target <> CompilerTarget.Dll then + if + tcConfig.win32res = "" + && tcConfig.win32icon <> "" + && tcConfig.target <> CompilerTarget.Dll + then use ms = new MemoryStream() use iconStream = FileSystem.OpenFileForReadShim(tcConfig.win32icon) Win32ResourceConversions.AppendIconToResourceStream(ms, iconStream) diff --git a/src/Compiler/Driver/FxResolver.fs b/src/Compiler/Driver/FxResolver.fs index 2d1eb4ce7ae..d769b36678e 100644 --- a/src/Compiler/Driver/FxResolver.fs +++ b/src/Compiler/Driver/FxResolver.fs @@ -492,13 +492,14 @@ type internal FxResolver defaultMscorlibVersion // Get the ProductVersion of this framework compare with table compatible monikers - match desktopProductVersionMonikers - |> Array.tryFind (fun (major, minor, build, revision, _) -> - (majorPart >= major) - && (minorPart >= minor) - && (buildPart >= build) - && (privatePart >= revision)) - with + match + desktopProductVersionMonikers + |> Array.tryFind (fun (major, minor, build, revision, _) -> + (majorPart >= major) + && (minorPart >= minor) + && (buildPart >= build) + && (privatePart >= revision)) + with | Some (_, _, _, _, moniker) -> moniker | None -> // no TFM could be found, assume latest stable? @@ -653,7 +654,8 @@ type internal FxResolver "System.Configuration" getFSharpCoreLibraryName - if useFsiAuxLib then fsiLibraryName + if useFsiAuxLib then + fsiLibraryName // always include a default reference to System.ValueTuple.dll in scripts and out-of-project sources match getSystemValueTupleImplementationReference () with @@ -687,7 +689,8 @@ type internal FxResolver [ yield! Directory.GetFiles(implDir, "*.dll") getFSharpCoreImplementationReference () - if useFsiAuxLib then getFsiLibraryImplementationReference () + if useFsiAuxLib then + getFsiLibraryImplementationReference () ] (getDependenciesOf roots).Values |> Seq.toList @@ -979,7 +982,8 @@ type internal FxResolver [ yield! Directory.GetFiles(path, "*.dll") getFSharpCoreImplementationReference () - if useFsiAuxLib then getFsiLibraryImplementationReference () + if useFsiAuxLib then + getFsiLibraryImplementationReference () ] |> List.filter (fun f -> systemAssemblies.Contains(Path.GetFileNameWithoutExtension(f))) diff --git a/src/Compiler/Driver/OptimizeInputs.fs b/src/Compiler/Driver/OptimizeInputs.fs index bd8a76ab674..fc276a711a0 100644 --- a/src/Compiler/Driver/OptimizeInputs.fs +++ b/src/Compiler/Driver/OptimizeInputs.fs @@ -232,8 +232,10 @@ let GenerateIlxCode ) = let mainMethodInfo = - if (tcConfig.target = CompilerTarget.Dll) - || (tcConfig.target = CompilerTarget.Module) then + if + (tcConfig.target = CompilerTarget.Dll) + || (tcConfig.target = CompilerTarget.Module) + then None else Some topAttrs.mainMethodAttrs diff --git a/src/Compiler/Driver/ParseAndCheckInputs.fs b/src/Compiler/Driver/ParseAndCheckInputs.fs index 3470f97a8af..6d764f264dd 100644 --- a/src/Compiler/Driver/ParseAndCheckInputs.fs +++ b/src/Compiler/Driver/ParseAndCheckInputs.fs @@ -617,7 +617,8 @@ let ParseOneInputLexbuf (tcConfig: TcConfig, lexResourceManager, lexbuf, fileNam ) // Report the statistics for testing purposes - if tcConfig.reportNumDecls then ReportParsingStatistics res + if tcConfig.reportNumDecls then + ReportParsingStatistics res res) diff --git a/src/Compiler/Driver/ScriptClosure.fs b/src/Compiler/Driver/ScriptClosure.fs index 67adfb1e8de..868a9f80cae 100644 --- a/src/Compiler/Driver/ScriptClosure.fs +++ b/src/Compiler/Driver/ScriptClosure.fs @@ -98,7 +98,8 @@ module ScriptPreprocessClosure = let seen = Dictionary<_, bool>() member _.SetSeen check = - if not (seen.ContainsKey check) then seen.Add(check, true) + if not (seen.ContainsKey check) then + seen.Add(check, true) member _.HaveSeen check = seen.ContainsKey check diff --git a/src/Compiler/Driver/StaticLinking.fs b/src/Compiler/Driver/StaticLinking.fs index 6c23eb9b024..5ad9ff15f40 100644 --- a/src/Compiler/Driver/StaticLinking.fs +++ b/src/Compiler/Driver/StaticLinking.fs @@ -304,8 +304,10 @@ let FindDependentILModulesForStaticLinking (ctok, tcConfig: TcConfig, tcImports: let ilAssemRef = List.head remaining remaining <- List.tail remaining - if assumedIndependentSet.Contains ilAssemRef.Name - || (ilAssemRef.PublicKey = Some ecmaPublicKey) then + if + assumedIndependentSet.Contains ilAssemRef.Name + || (ilAssemRef.PublicKey = Some ecmaPublicKey) + then depModuleTable[ilAssemRef.Name] <- dummyEntry ilAssemRef.Name else if not (depModuleTable.ContainsKey ilAssemRef.Name) then match tcImports.TryFindDllInfo(ctok, rangeStartup, ilAssemRef.Name, lookupOnly = false) with @@ -502,10 +504,11 @@ let StaticLink (ctok, tcConfig: TcConfig, tcImports: TcImports, ilGlobals: ILGlo | Some provAssemStaticLinkInfo -> (importedBinary, provAssemStaticLinkInfo) ] #endif - if not tcConfig.standalone - && tcConfig.extraStaticLinkRoots.IsEmpty + if + not tcConfig.standalone + && tcConfig.extraStaticLinkRoots.IsEmpty #if !NO_TYPEPROVIDERS - && providerGeneratedAssemblies.IsEmpty + && providerGeneratedAssemblies.IsEmpty #endif then id diff --git a/src/Compiler/Driver/XmlDocFileWriter.fs b/src/Compiler/Driver/XmlDocFileWriter.fs index 97125744ace..fe6ac2a3fac 100644 --- a/src/Compiler/Driver/XmlDocFileWriter.fs +++ b/src/Compiler/Driver/XmlDocFileWriter.fs @@ -63,7 +63,8 @@ module XmlDocWriter = let ptext = defaultArg path "" - if mspec.IsModule then doModuleMemberSig ptext mspec + if mspec.IsModule then + doModuleMemberSig ptext mspec let vals = mtype.AllValsAndMembers @@ -116,7 +117,9 @@ module XmlDocWriter = let rec doModule (mspec: ModuleOrNamespace) = let mtype = mspec.ModuleOrNamespaceType - if mspec.IsModule then modulMember mspec + + if mspec.IsModule then + modulMember mspec let vals = mtype.AllValsAndMembers diff --git a/src/Compiler/Driver/fsc.fs b/src/Compiler/Driver/fsc.fs index b0519d50a8d..84fd4742d6d 100644 --- a/src/Compiler/Driver/fsc.fs +++ b/src/Compiler/Driver/fsc.fs @@ -149,7 +149,8 @@ type ConsoleLoggerProvider() = /// Notify the exiter if any error has occurred let AbortOnError (diagnosticsLogger: DiagnosticsLogger, exiter: Exiter) = - if diagnosticsLogger.ErrorCount > 0 then exiter.Exit 1 + if diagnosticsLogger.ErrorCount > 0 then + exiter.Exit 1 let TypeCheck ( @@ -382,7 +383,8 @@ module InterfaceFileWriter = for impl in declaredImpls do writeToFile os impl - if tcConfig.printSignatureFile <> "" then os.Dispose() + if tcConfig.printSignatureFile <> "" then + os.Dispose() let extensionForFile (filePath: string) = if (List.exists (FileSystemUtils.checkSuffix filePath) FSharpMLCompatFileSuffixes) then @@ -489,11 +491,13 @@ let main1 // See Bug 735819 let lcidFromCodePage = - if (Console.OutputEncoding.CodePage <> 65001) - && (Console.OutputEncoding.CodePage - <> Thread.CurrentThread.CurrentUICulture.TextInfo.OEMCodePage) - && (Console.OutputEncoding.CodePage - <> Thread.CurrentThread.CurrentUICulture.TextInfo.ANSICodePage) then + if + (Console.OutputEncoding.CodePage <> 65001) + && (Console.OutputEncoding.CodePage + <> Thread.CurrentThread.CurrentUICulture.TextInfo.OEMCodePage) + && (Console.OutputEncoding.CodePage + <> Thread.CurrentThread.CurrentUICulture.TextInfo.ANSICodePage) + then Thread.CurrentThread.CurrentUICulture <- CultureInfo("en-US") Some 1033 else @@ -553,7 +557,8 @@ let main1 tcConfigB.conditionalDefines <- "COMPILED" :: tcConfigB.conditionalDefines // Display the banner text, if necessary - if not bannerAlreadyPrinted then DisplayBannerText tcConfigB + if not bannerAlreadyPrinted then + DisplayBannerText tcConfigB // Create tcGlobals and frameworkTcImports let outfile, pdbfile, assemblyName = @@ -633,7 +638,8 @@ let main1 printfn "%+A" input printf "\n" - if tcConfig.parseOnly then exiter.Exit 0 + if tcConfig.parseOnly then + exiter.Exit 0 if not tcConfig.continueAfterParseFailure then AbortOnError(diagnosticsLogger, exiter) @@ -659,7 +665,8 @@ let main1 if not tcConfig.continueAfterParseFailure then AbortOnError(diagnosticsLogger, exiter) - if tcConfig.importAllReferencesOnly then exiter.Exit 0 + if tcConfig.importAllReferencesOnly then + exiter.Exit 0 // Build the initial type checking environment ReportTime tcConfig "Typecheck" @@ -912,7 +919,8 @@ let main2 ilSourceDocs)) = - if tcConfig.typeCheckOnly then exiter.Exit 0 + if tcConfig.typeCheckOnly then + exiter.Exit 0 generatedCcu.Contents.SetAttribs(generatedCcu.Contents.Attribs @ topAttrs.assemblyAttrs) @@ -945,7 +953,7 @@ let main2 "AssemblyVersionAttribute" topAttrs.assemblyAttrs tcConfig.deterministic - with + with | Some v -> match tcConfig.version with | VersionNone -> Some v @@ -1351,9 +1359,11 @@ let main6 AbortOnError(diagnosticsLogger, exiter) // Don't copy referenced FSharp.core.dll if we are building FSharp.Core.dll - if (tcConfig.copyFSharpCore = CopyFSharpCoreFlag.Yes) - && not tcConfig.compilingFSharpCore - && not tcConfig.standalone then + if + (tcConfig.copyFSharpCore = CopyFSharpCoreFlag.Yes) + && not tcConfig.compilingFSharpCore + && not tcConfig.standalone + then CopyFSharpCore(outfile, tcConfig.referencedDLLs) ReportTime tcConfig "Exiting" diff --git a/src/Compiler/Service/FSharpCheckerResults.fs b/src/Compiler/Service/FSharpCheckerResults.fs index d11ae3d895b..c7f4e0ce0f0 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fs +++ b/src/Compiler/Service/FSharpCheckerResults.fs @@ -381,8 +381,10 @@ type internal TypeCheckInfo if contained then match bestAlmostIncludedSoFar with | Some (rightm: range, _, _) -> - if posGt possm.End rightm.End - || (posEq possm.End rightm.End && posGt possm.Start rightm.Start) then + if + posGt possm.End rightm.End + || (posEq possm.End rightm.End && posGt possm.Start rightm.Start) + then bestAlmostIncludedSoFar <- Some(possm, env, ad) | _ -> bestAlmostIncludedSoFar <- Some(possm, env, ad)) @@ -914,9 +916,10 @@ type internal TypeCheckInfo match TryToResolveLongIdentAsType ncenv nenv m plid with | Some x -> tryTcrefOfAppTy g x | None -> - match lastDotPos - |> Option.orElseWith (fun _ -> FindFirstNonWhitespacePosition lineStr (colAtEndOfNamesAndResidue - 1)) - with + match + lastDotPos + |> Option.orElseWith (fun _ -> FindFirstNonWhitespacePosition lineStr (colAtEndOfNamesAndResidue - 1)) + with | Some p when lineStr[p] = '.' -> match FindFirstNonWhitespacePosition lineStr (p - 1) with | Some colAtEndOfNames -> @@ -1154,7 +1157,7 @@ type internal TypeCheckInfo match GetClassOrRecordFieldsEnvironmentLookupResolutions(mkPos line loc, plid, false) |> toCompletionItems - with + with | [], _, _ -> // no record fields found, return completion list as if we were outside any computation expression GetDeclaredItems( @@ -2395,19 +2398,22 @@ module internal ParseAndCheckFile = let errors = [ for err, severity in diagnostics do - if severity = FSharpDiagnosticSeverity.Error then err + if severity = FSharpDiagnosticSeverity.Error then + err ] let warnings = [ for err, severity in diagnostics do - if severity = FSharpDiagnosticSeverity.Warning then err + if severity = FSharpDiagnosticSeverity.Warning then + err ] let infos = [ for err, severity in diagnostics do - if severity = FSharpDiagnosticSeverity.Info then err + if severity = FSharpDiagnosticSeverity.Info then + err ] let message = HashLoadedSourceHasIssues(infos, warnings, errors, rangeOfHashLoad) diff --git a/src/Compiler/Service/FSharpParseFileResults.fs b/src/Compiler/Service/FSharpParseFileResults.fs index 3959c84da3f..c2ee71a022e 100644 --- a/src/Compiler/Service/FSharpParseFileResults.fs +++ b/src/Compiler/Service/FSharpParseFileResults.fs @@ -498,7 +498,8 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput, let findBreakPoints () = let checkRange m = [ - if isMatchRange m && not m.IsSynthetic then yield m + if isMatchRange m && not m.IsSynthetic then + yield m ] let walkBindSeqPt sp = @@ -559,7 +560,8 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput, | _ -> false // This extends the range of the implicit debug point for 'do expr' range to include the 'do' - if extendDebugPointForDo then yield! checkRange m + if extendDebugPointForDo then + yield! checkRange m let useImplicitDebugPoint = match spInfo with @@ -944,9 +946,10 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput, if pos.Column = 0 then // we have a breakpoint that was set with mouse at line start - match locations - |> List.filter (fun m -> m.StartLine = m.EndLine && pos.Line = m.StartLine) - with + match + locations + |> List.filter (fun m -> m.StartLine = m.EndLine && pos.Line = m.StartLine) + with | [] -> match locations |> List.filter (fun m -> rangeContainsPos m pos) with | [] -> diff --git a/src/Compiler/Service/ItemKey.fs b/src/Compiler/Service/ItemKey.fs index 2854da14a25..261d6ec094f 100644 --- a/src/Compiler/Service/ItemKey.fs +++ b/src/Compiler/Service/ItemKey.fs @@ -150,7 +150,9 @@ type ItemKeyStore(mmf: MemoryMappedFile, length) = while reader.Offset < reader.Length do let m = this.ReadRange &reader let keyString2 = this.ReadKeyString &reader - if keyString1.SequenceEqual keyString2 then results.Add m + + if keyString1.SequenceEqual keyString2 then + results.Add m results :> range seq @@ -271,7 +273,9 @@ and [] ItemKeyStoreBuilder() = and writeTypar (isStandalone: bool) (typar: Typar) = match typar.Solution with | Some ty -> writeType isStandalone ty - | _ -> if isStandalone then writeInt64 typar.Stamp + | _ -> + if isStandalone then + writeInt64 typar.Stamp let writeValRef (vref: ValRef) = match vref.MemberInfo with diff --git a/src/Compiler/Service/SemanticClassification.fs b/src/Compiler/Service/SemanticClassification.fs index c95195db8ff..bdbc73d783a 100644 --- a/src/Compiler/Service/SemanticClassification.fs +++ b/src/Compiler/Service/SemanticClassification.fs @@ -93,12 +93,14 @@ module TcResolutionsExtensions = | _ -> None let (|KeywordIntrinsicValue|_|) (vref: ValRef) = - if valRefEq g g.raise_vref vref - || valRefEq g g.reraise_vref vref - || valRefEq g g.typeof_vref vref - || valRefEq g g.typedefof_vref vref - || valRefEq g g.sizeof_vref vref - || valRefEq g g.nameof_vref vref then + if + valRefEq g g.raise_vref vref + || valRefEq g g.reraise_vref vref + || valRefEq g g.typeof_vref vref + || valRefEq g g.typedefof_vref vref + || valRefEq g g.sizeof_vref vref + || valRefEq g g.nameof_vref vref + then Some() else None @@ -257,8 +259,10 @@ module TcResolutionsExtensions = match minfos with | [] -> add m SemanticClassificationType.Method | _ -> - if minfos - |> List.forall (fun minfo -> minfo.IsExtensionMember || minfo.IsCSharpStyleExtensionMember) then + if + minfos + |> List.forall (fun minfo -> minfo.IsExtensionMember || minfo.IsCSharpStyleExtensionMember) + then add m SemanticClassificationType.ExtensionMethod else add m SemanticClassificationType.Method diff --git a/src/Compiler/Service/ServiceAnalysis.fs b/src/Compiler/Service/ServiceAnalysis.fs index 09e3545e8ad..38af8f7156c 100644 --- a/src/Compiler/Service/ServiceAnalysis.fs +++ b/src/Compiler/Service/ServiceAnalysis.fs @@ -40,7 +40,8 @@ module UnusedOpens = // fv.IsExtensionMember is always false for C# extension methods returning by `MembersFunctionsAndValues`, // so we have to check Extension attribute instead. // (note: fv.IsExtensionMember has proper value for symbols returning by GetAllUsesOfAllSymbolsInFile though) - if fv.HasAttribute() then fv + if fv.HasAttribute() then + fv for apCase in entity.ActivePatternCases do apCase @@ -429,11 +430,13 @@ module UnusedDeclarations = symbolsUses |> Seq.distinctBy (fun su -> su.Range) // Account for "hidden" uses, like a val in a member val definition. These aren't relevant |> Seq.choose (fun (su: FSharpSymbolUse) -> - if su.IsFromDefinition - && su.Symbol.DeclarationLocation.IsSome - && (isScript || su.IsPrivateToFile) - && not (su.Symbol.DisplayName.StartsWith "_") - && isPotentiallyUnusedDeclaration su.Symbol then + if + su.IsFromDefinition + && su.Symbol.DeclarationLocation.IsSome + && (isScript || su.IsPrivateToFile) + && not (su.Symbol.DisplayName.StartsWith "_") + && isPotentiallyUnusedDeclaration su.Symbol + then Some(su, usages.Contains su.Symbol.DeclarationLocation.Value) else None) diff --git a/src/Compiler/Service/ServiceInterfaceStubGenerator.fs b/src/Compiler/Service/ServiceInterfaceStubGenerator.fs index 5458e129ffd..410d02dc786 100644 --- a/src/Compiler/Service/ServiceInterfaceStubGenerator.fs +++ b/src/Compiler/Service/ServiceInterfaceStubGenerator.fs @@ -206,9 +206,11 @@ module InterfaceStubGenerator = let nm = match arg.Name with | None -> - if arg.Type.HasTypeDefinition - && arg.Type.TypeDefinition.CompiledName = "unit" - && arg.Type.TypeDefinition.Namespace = Some "Microsoft.FSharp.Core" then + if + arg.Type.HasTypeDefinition + && arg.Type.TypeDefinition.CompiledName = "unit" + && arg.Type.TypeDefinition.Namespace = Some "Microsoft.FSharp.Core" + then "()" else sprintf "arg%d" (namesWithIndices |> Map.toSeq |> Seq.map snd |> Seq.sumBy Set.count |> max 1) @@ -303,8 +305,10 @@ module InterfaceStubGenerator = let internal normalizePropertyName (v: FSharpMemberOrFunctionOrValue) = let displayName = v.DisplayName - if (v.IsPropertyGetterMethod && displayName.StartsWithOrdinal("get_")) - || (v.IsPropertySetterMethod && displayName.StartsWithOrdinal("set_")) then + if + (v.IsPropertyGetterMethod && displayName.StartsWithOrdinal("get_")) + || (v.IsPropertySetterMethod && displayName.StartsWithOrdinal("set_")) + then displayName[4..] else displayName @@ -362,7 +366,8 @@ module InterfaceStubGenerator = [ if v.InlineAnnotation = FSharpInlineAnnotation.AlwaysInline then yield "inline" - if v.Accessibility.IsInternal then yield "internal" + if v.Accessibility.IsInternal then + yield "internal" ] let argInfos, retType = getArgTypes ctx v @@ -371,9 +376,13 @@ module InterfaceStubGenerator = // A couple of helper methods for emitting close declarations of members and stub method bodies. let closeDeclaration (returnType: string) (writer: ColumnIndentedTextWriter) = - if verboseMode then writer.Write(": {0}", returnType) + if verboseMode then + writer.Write(": {0}", returnType) + writer.Write(" = ", returnType) - if verboseMode then writer.WriteLine("") + + if verboseMode then + writer.WriteLine("") let writeImplementation (ctx: Context) (writer: ColumnIndentedTextWriter) = match verboseMode, ctx.MethodBody with @@ -435,7 +444,10 @@ module InterfaceStubGenerator = let closeDeclaration = closeDeclaration retType let writeImplementation = writeImplementation ctx let writer = ctx.Writer - if isEventMember v then writer.WriteLine("[]") + + if isEventMember v then + writer.WriteLine("[]") + writer.Write("member ") for modifier in modifiers do @@ -464,7 +476,9 @@ module InterfaceStubGenerator = writer.Write(")") writer.Write(" = ") - if verboseMode then writer.WriteLine("") + + if verboseMode then + writer.WriteLine("") writer |> writeImplementation writer.Unindent ctx.Indentation diff --git a/src/Compiler/Service/ServiceLexing.fs b/src/Compiler/Service/ServiceLexing.fs index 9ecdbb823a4..9f14d717af2 100644 --- a/src/Compiler/Service/ServiceLexing.fs +++ b/src/Compiler/Service/ServiceLexing.fs @@ -683,8 +683,10 @@ module internal LexerStateEncoding = let kind2 = ((nestingValue &&& 0b000000000011) >>> 0) [ - if tag1 then i1, decodeStringStyle kind1, range0 - if tag2 then i2, decodeStringStyle kind2, range0 + if tag1 then + i1, decodeStringStyle kind1, range0 + if tag2 then + i2, decodeStringStyle kind2, range0 ] (colorState, ncomments, pos, ifDefs, hardwhite, stringKind, stringNest) diff --git a/src/Compiler/Service/ServiceNavigation.fs b/src/Compiler/Service/ServiceNavigation.fs index f162076d44e..68b7eb268f9 100755 --- a/src/Compiler/Service/ServiceNavigation.fs +++ b/src/Compiler/Service/ServiceNavigation.fs @@ -831,7 +831,9 @@ module NavigateTo = and walkSynModuleOrNamespaceSig (inp: SynModuleOrNamespaceSig) container = let (SynModuleOrNamespaceSig (longId = lid; kind = kind; decls = decls)) = inp let isModule = kind.IsModule - if isModule then addModule lid true container + + if isModule then + addModule lid true container let container = { @@ -900,7 +902,9 @@ module NavigateTo = and walkSynModuleOrNamespace inp container = let (SynModuleOrNamespace (longId = lid; kind = kind; decls = decls)) = inp let isModule = kind.IsModule - if isModule then addModule lid false container + + if isModule then + addModule lid false container let container = { diff --git a/src/Compiler/Service/ServiceParamInfoLocations.fs b/src/Compiler/Service/ServiceParamInfoLocations.fs index 35b4b777d8a..ff34dd392d4 100755 --- a/src/Compiler/Service/ServiceParamInfoLocations.fs +++ b/src/Compiler/Service/ServiceParamInfoLocations.fs @@ -222,8 +222,10 @@ module internal ParameterLocationsImpl = let lidm = lidwd.Range let betweenTheBrackets = mkRange wholem.FileName openm.Start wholem.End - if SyntaxTraversal.rangeContainsPosEdgesExclusive betweenTheBrackets pos - && args |> List.forall isStaticArg then + if + SyntaxTraversal.rangeContainsPosEdgesExclusive betweenTheBrackets pos + && args |> List.forall isStaticArg + then let commasAndCloseParen = [ for c in commas -> c.End ] @ [ wholem.End ] Some( @@ -344,8 +346,10 @@ module internal ParameterLocationsImpl = | None -> let typeArgsm = mkRange openm.FileName openm.Start wholem.End - if SyntaxTraversal.rangeContainsPosEdgesExclusive typeArgsm pos - && tyArgs |> List.forall isStaticArg then + if + SyntaxTraversal.rangeContainsPosEdgesExclusive typeArgsm pos + && tyArgs |> List.forall isStaticArg + then let commasAndCloseParen = [ for c in commas -> c.End ] @ [ wholem.End ] let argRanges = diff --git a/src/Compiler/Service/ServiceParseTreeWalk.fs b/src/Compiler/Service/ServiceParseTreeWalk.fs index 32e20db6486..e2eedc9ba47 100755 --- a/src/Compiler/Service/ServiceParseTreeWalk.fs +++ b/src/Compiler/Service/ServiceParseTreeWalk.fs @@ -246,14 +246,15 @@ module SyntaxTraversal = else None) diveResults - with + with | [] -> // No entity's range contained the desired position. However the ranges in the parse tree only span actual characters present in the file. // The cursor may be at whitespace between entities or after everything, so find the nearest entity with the range left of the position. let mutable e = diveResults.Head for r in diveResults do - if posGt pos (fst r).Start then e <- r + if posGt pos (fst r).Start then + e <- r snd (e) () | [ x ] -> x () @@ -396,9 +397,11 @@ module SyntaxTraversal = // special-case:caret is located in the offside position below inherit // inherit A() // $ - if not (rangeContainsPos expr.Range pos) - && sepOpt.IsNone - && pos.Column = inheritRange.StartColumn then + if + not (rangeContainsPos expr.Range pos) + && sepOpt.IsNone + && pos.Column = inheritRange.StartColumn + then visitor.VisitRecordField(path, None, None) else traverseSynExpr expr) @@ -451,9 +454,11 @@ module SyntaxTraversal = // special case: caret is below field binding // field x = 5 // $ - if not (rangeContainsPos e.Range pos) - && sepOpt.IsNone - && pos.Column = offsideColumn then + if + not (rangeContainsPos e.Range pos) + && sepOpt.IsNone + && pos.Column = offsideColumn + then visitor.VisitRecordField(path, copyOpt, None) else traverseSynExpr expr) diff --git a/src/Compiler/Service/ServiceParsedInputOps.fs b/src/Compiler/Service/ServiceParsedInputOps.fs index f61893d0eaf..757cd90a264 100644 --- a/src/Compiler/Service/ServiceParsedInputOps.fs +++ b/src/Compiler/Service/ServiceParsedInputOps.fs @@ -1539,7 +1539,9 @@ module ParsedInput = None override this.VisitModuleOrNamespace(_, SynModuleOrNamespace (longId = longId; range = range)) = - if rangeContainsPos range pos then path <- path @ longId + if rangeContainsPos range pos then + path <- path @ longId + None // we should traverse the rest of the AST to find the smallest module } @@ -1916,7 +1918,9 @@ module ParsedInput = List.iter walkAttribute attrs List.iter walkTyparDecl typars List.iter walkTypeConstraint constraints - if isTypeExtensionOrAlias then addLongIdent longIdent + + if isTypeExtensionOrAlias then + addLongIdent longIdent and walkTypeDefnRepr inp = match inp with diff --git a/src/Compiler/Service/ServiceStructure.fs b/src/Compiler/Service/ServiceStructure.fs index 8e3a96112ca..995e4e4d3e9 100644 --- a/src/Compiler/Service/ServiceStructure.fs +++ b/src/Compiler/Service/ServiceStructure.fs @@ -319,24 +319,28 @@ module Structure = | SynExpr.App (atomicFlag, isInfix, funcExpr, argExpr, r) -> // seq exprs, custom operators, etc - if ExprAtomicFlag.NonAtomic = atomicFlag - && not isInfix - && (match funcExpr with - | SynExpr.Ident _ -> true - | _ -> false) - && (match argExpr with - | SynExpr.ComputationExpr _ -> false - | _ -> true) then + if + ExprAtomicFlag.NonAtomic = atomicFlag + && not isInfix + && (match funcExpr with + | SynExpr.Ident _ -> true + | _ -> false) + && (match argExpr with + | SynExpr.ComputationExpr _ -> false + | _ -> true) + then // if the argExpr is a computation expression another match will handle the outlining // these cases must be removed to prevent creating unnecessary tags for the same scope let collapse = Range.endToEnd funcExpr.Range r rcheck Scope.SpecialFunc Collapse.Below r collapse - elif ExprAtomicFlag.NonAtomic = atomicFlag - && (not isInfix) - && (match argExpr with - | SynExpr.ComputationExpr _ -> true - | _ -> false) then + elif + ExprAtomicFlag.NonAtomic = atomicFlag + && (not isInfix) + && (match argExpr with + | SynExpr.ComputationExpr _ -> true + | _ -> false) + then let collapse = Range.startToEnd argExpr.Range r let collapse = Range.modBoth 1 1 collapse rcheck Scope.ComputationExpr Collapse.Same r collapse diff --git a/src/Compiler/Service/service.fs b/src/Compiler/Service/service.fs index 023c0ddfe2a..20fd5956c43 100644 --- a/src/Compiler/Service/service.fs +++ b/src/Compiler/Service/service.fs @@ -334,11 +334,13 @@ type BackgroundCompiler // these cross-project references to FSharp.Core are VisualFSharp.sln and FSharp.sln. The ramification // of this is that you need to build FSharp.Core to get intellisense in those projects. - if (try + if + (try Path.GetFileNameWithoutExtension(nm) - with _ -> - "") - <> GetFSharpCoreLibraryName() then + with _ -> + "") + <> GetFSharpCoreLibraryName() + then { new IProjectReference with member x.EvaluateRawContents() = node { diff --git a/src/Compiler/SyntaxTree/LexHelpers.fs b/src/Compiler/SyntaxTree/LexHelpers.fs index c9b201b9445..67f6c78f558 100644 --- a/src/Compiler/SyntaxTree/LexHelpers.fs +++ b/src/Compiler/SyntaxTree/LexHelpers.fs @@ -211,7 +211,8 @@ let stringBufferIsBytes (buf: ByteBuffer) = let mutable ok = true for i = 0 to bytes.Length / 2 - 1 do - if bytes.Span[i * 2 + 1] <> 0uy then ok <- false + if bytes.Span[i * 2 + 1] <> 0uy then + ok <- false ok @@ -237,15 +238,20 @@ let hexdigit d = else failwith "hexdigit" let unicodeGraphShort (s: string) = - if s.Length <> 4 then failwith "unicodegraph" + if s.Length <> 4 then + failwith "unicodegraph" + uint16 (hexdigit s[0] * 4096 + hexdigit s[1] * 256 + hexdigit s[2] * 16 + hexdigit s[3]) let hexGraphShort (s: string) = - if s.Length <> 2 then failwith "hexgraph" + if s.Length <> 2 then + failwith "hexgraph" + uint16 (hexdigit s[0] * 16 + hexdigit s[1]) let unicodeGraphLong (s: string) = - if s.Length <> 8 then failwith "unicodeGraphLong" + if s.Length <> 8 then + failwith "unicodeGraphLong" let high = hexdigit s[0] * 4096 + hexdigit s[1] * 256 + hexdigit s[2] * 16 + hexdigit s[3] in diff --git a/src/Compiler/SyntaxTree/ParseHelpers.fs b/src/Compiler/SyntaxTree/ParseHelpers.fs index bcaebd20b92..ff7a44e98a4 100644 --- a/src/Compiler/SyntaxTree/ParseHelpers.fs +++ b/src/Compiler/SyntaxTree/ParseHelpers.fs @@ -25,7 +25,7 @@ open Internal.Utilities.Text.Parsing /// information about the grammar at the point where the error occurred, e.g. what tokens /// are valid to shift next at that point in the grammar. This information is processed in CompileOps.fs. [] -exception SyntaxError of obj (* ParseErrorContext<_> *) * range: range +exception SyntaxError of obj (* ParseErrorContext<_> *) * range: range exception IndentationProblem of string * range diff --git a/src/Compiler/SyntaxTree/PrettyNaming.fs b/src/Compiler/SyntaxTree/PrettyNaming.fs index ad02a04b1b7..6e25b5c6360 100755 --- a/src/Compiler/SyntaxTree/PrettyNaming.fs +++ b/src/Compiler/SyntaxTree/PrettyNaming.fs @@ -527,7 +527,8 @@ let DoesIdentifierNeedBackticks (name: string) : bool = /// A utility to help determine if an identifier needs to be quoted let AddBackticksToIdentifierIfNeeded (name: string) : string = if - DoesIdentifierNeedBackticks name && not (name.StartsWithOrdinal("`")) + DoesIdentifierNeedBackticks name + && not (name.StartsWithOrdinal("`")) && not (name.EndsWithOrdinal("`")) then "``" + name + "``" @@ -820,7 +821,10 @@ let TryDemangleGenericNameAndPos (n: string) = while res && i < n.Length do let char = n[i] - if not (char >= '0' && char <= '9') then res <- false + + if not (char >= '0' && char <= '9') then + res <- false + i <- i + 1 if res then ValueSome pos else ValueNone diff --git a/src/Compiler/SyntaxTree/XmlDoc.fs b/src/Compiler/SyntaxTree/XmlDoc.fs index 81dbde3ca22..72c657d2911 100644 --- a/src/Compiler/SyntaxTree/XmlDoc.fs +++ b/src/Compiler/SyntaxTree/XmlDoc.fs @@ -262,7 +262,10 @@ type PreXmlDoc = let lines = Array.map fst preLines let m = Array.reduce unionRanges (Array.map snd preLines) let doc = XmlDoc(lines, m) - if check then doc.Check(paramNamesOpt) + + if check then + doc.Check(paramNamesOpt) + doc member internal x.Range = diff --git a/src/Compiler/TypedTree/TypedTree.fs b/src/Compiler/TypedTree/TypedTree.fs index 3b328134868..2d3f8c0943f 100644 --- a/src/Compiler/TypedTree/TypedTree.fs +++ b/src/Compiler/TypedTree/TypedTree.fs @@ -2488,6 +2488,9 @@ type ValOptionalData = /// Used to implement [] mutable val_defn: Expr option + /// Records the "extra information" for a value compiled as a method (rather + /// than a closure or a local), including argument names, attributes etc. + // // MUTABILITY CLEANUP: mutability of this field is used by // -- adjustAllUsesOfRecValue // -- TLR optimizations @@ -2497,6 +2500,10 @@ type ValOptionalData = // type-checked expression. mutable val_repr_info: ValReprInfo option + /// Records the "extra information" for display purposes for expression-level function definitions + /// that may be compiled as closures (that is are not necessarily compiled as top-level methods). + mutable val_repr_info_for_display: ValReprInfo option + /// How visible is this? /// MUTABILITY: for unpickle linkage mutable val_access: Accessibility @@ -2556,6 +2563,7 @@ type Val = val_const = None val_defn = None val_repr_info = None + val_repr_info_for_display = None val_access = TAccess [] val_xmldoc = XmlDoc.Empty val_member_info = None @@ -2620,6 +2628,11 @@ type Val = | Some optData -> optData.val_repr_info | _ -> None + member x.ValReprInfoForDisplay: ValReprInfo option = + match x.val_opt_data with + | Some optData -> optData.val_repr_info_for_display + | _ -> None + member x.Id = ident(x.LogicalName, x.Range) /// Is this represented as a "top level" static binding (i.e. a static field, static member, @@ -2998,6 +3011,11 @@ type Val = | Some optData -> optData.val_repr_info <- info | _ -> x.val_opt_data <- Some { Val.NewEmptyValOptData() with val_repr_info = info } + member x.SetValReprInfoForDisplay info = + match x.val_opt_data with + | Some optData -> optData.val_repr_info_for_display <- info + | _ -> x.val_opt_data <- Some { Val.NewEmptyValOptData() with val_repr_info_for_display = info } + member x.SetType ty = x.val_type <- ty member x.SetOtherRange m = @@ -3055,6 +3073,7 @@ type Val = val_other_range = tg.val_other_range val_const = tg.val_const val_defn = tg.val_defn + val_repr_info_for_display = tg.val_repr_info_for_display val_repr_info = tg.val_repr_info val_access = tg.val_access val_xmldoc = tg.val_xmldoc diff --git a/src/Compiler/TypedTree/TypedTree.fsi b/src/Compiler/TypedTree/TypedTree.fsi index d2a23e73038..cdcf93e4518 100644 --- a/src/Compiler/TypedTree/TypedTree.fsi +++ b/src/Compiler/TypedTree/TypedTree.fsi @@ -1777,8 +1777,15 @@ type ValOptionalData = /// What is the original, unoptimized, closed-term definition, if any? /// Used to implement [] mutable val_defn: Expr option + + /// Records the "extra information" for a value compiled as a method (rather + /// than a closure or a local), including argument names, attributes etc. mutable val_repr_info: ValReprInfo option + /// Records the "extra information" for display purposes for expression-level function definitions + /// that may be compiled as closures (that is are not necessarily compiled as top-level methods). + mutable val_repr_info_for_display: ValReprInfo option + /// How visible is this? /// MUTABILITY: for unpickle linkage mutable val_access: Accessibility @@ -1888,6 +1895,8 @@ type Val = member SetValReprInfo: info: ValReprInfo option -> unit + member SetValReprInfoForDisplay: info: ValReprInfo option -> unit + override ToString: unit -> string /// How visible is this value, function or member? @@ -2134,6 +2143,10 @@ type Val = /// represent as "top level" bindings. member ValReprInfo: ValReprInfo option + /// Records the "extra information" for display purposes for expression-level function definitions + /// that may be compiled as closures (that is are not necessarily compiled as top-level methods). + member ValReprInfoForDisplay: ValReprInfo option + /// Get the declared documentation for the value member XmlDoc: XmlDoc diff --git a/src/Compiler/TypedTree/TypedTreeBasics.fs b/src/Compiler/TypedTree/TypedTreeBasics.fs index b0020664ff7..1ec0b619604 100644 --- a/src/Compiler/TypedTree/TypedTreeBasics.fs +++ b/src/Compiler/TypedTree/TypedTreeBasics.fs @@ -26,7 +26,7 @@ let getNameOfScopeRef sref = | ILScopeRef.Assembly aref -> aref.Name | ILScopeRef.PrimaryAssembly -> "" -/// Metadata on values (names of arguments etc. +/// Metadata on values (names of arguments etc.) module ValReprInfo = let unnamedTopArg1: ArgReprInfo = { Attribs=[]; Name=None } @@ -41,6 +41,11 @@ module ValReprInfo = let emptyValData = ValReprInfo([], [], unnamedRetVal) + let IsEmpty info = + match info with + | ValReprInfo([], [], { Attribs = []; Name=None }) -> true + | _ -> false + let InferTyparInfo (tps: Typar list) = tps |> List.map (fun tp -> TyparReprInfo(tp.Id, tp.Kind)) let InferArgReprInfo (v: Val) : ArgReprInfo = { Attribs = []; Name= Some v.Id } @@ -59,7 +64,18 @@ let typesOfVals (v: Val list) = v |> List.map (fun v -> v.Type) let nameOfVal (v: Val) = v.LogicalName -let arityOfVal (v: Val) = (match v.ValReprInfo with None -> ValReprInfo.emptyValData | Some arities -> arities) +let arityOfVal (v: Val) = + match v.ValReprInfo with + | None -> ValReprInfo.emptyValData + | Some info -> info + +let arityOfValForDisplay (v: Val) = + match v.ValReprInfoForDisplay with + | Some info -> info + | None -> + match v.ValReprInfo with + | None -> ValReprInfo.emptyValData + | Some info -> info let tupInfoRef = TupInfo.Const false diff --git a/src/Compiler/TypedTree/TypedTreeBasics.fsi b/src/Compiler/TypedTree/TypedTreeBasics.fsi index 246a9e74baa..fe4930a71d7 100644 --- a/src/Compiler/TypedTree/TypedTreeBasics.fsi +++ b/src/Compiler/TypedTree/TypedTreeBasics.fsi @@ -29,6 +29,8 @@ module ValReprInfo = val emptyValData: ValReprInfo + val IsEmpty: ValReprInfo -> bool + val InferTyparInfo: tps: Typar list -> TyparReprInfo list val InferArgReprInfo: v: Val -> ArgReprInfo @@ -45,6 +47,8 @@ val nameOfVal: v: Val -> string val arityOfVal: v: Val -> ValReprInfo +val arityOfValForDisplay: v: Val -> ValReprInfo + val tupInfoRef: TupInfo val tupInfoStruct: TupInfo diff --git a/src/Compiler/TypedTree/TypedTreeOps.fs b/src/Compiler/TypedTree/TypedTreeOps.fs index fd00a1f94bd..cef7fe70b74 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.fs @@ -5359,7 +5359,8 @@ let InferArityOfExpr g allowTypeDirectedDetupling ty partialArgAttribsL retAttri (ids, attribs) ||> List.map2 (fun id attribs -> { Name = id; Attribs = attribs }: ArgReprInfo )) let retInfo: ArgReprInfo = { Attribs = retAttribs; Name = None } - ValReprInfo (ValReprInfo.InferTyparInfo tps, curriedArgInfos, retInfo) + let info = ValReprInfo (ValReprInfo.InferTyparInfo tps, curriedArgInfos, retInfo) + if ValReprInfo.IsEmpty info then ValReprInfo.emptyValData else info let InferArityOfExprBinding g allowTypeDirectedDetupling (v: Val) expr = match v.ValReprInfo with diff --git a/src/Compiler/TypedTree/TypedTreePickle.fs b/src/Compiler/TypedTree/TypedTreePickle.fs index eda40c33fb5..3f5ba37afde 100644 --- a/src/Compiler/TypedTree/TypedTreePickle.fs +++ b/src/Compiler/TypedTree/TypedTreePickle.fs @@ -2353,6 +2353,7 @@ and u_ValData st = val_other_range = (match x1a with None -> None | Some(_, b) -> Some(b, true)) val_defn = None val_repr_info = x10 + val_repr_info_for_display = None val_const = x14 val_access = x13 val_xmldoc = defaultArg x15 XmlDoc.Empty diff --git a/src/Compiler/Utilities/FileSystem.fs b/src/Compiler/Utilities/FileSystem.fs index 465adeac51d..bdd64e87b69 100644 --- a/src/Compiler/Utilities/FileSystem.fs +++ b/src/Compiler/Utilities/FileSystem.fs @@ -127,7 +127,8 @@ type ByteArrayMemory(bytes: byte[], offset, length) = ByteArrayMemory(Array.empty, 0, 0) :> ByteMemory override _.CopyTo stream = - if length > 0 then stream.Write(bytes, offset, length) + if length > 0 then + stream.Write(bytes, offset, length) override _.Copy(srcOffset, dest, destOffset, count) = checkCount count @@ -412,7 +413,8 @@ module internal FileSystemUtils = let checkSuffix (path: string) (suffix: string) = path.EndsWithOrdinalIgnoreCase(suffix) let hasExtensionWithValidate (validate: bool) (s: string) = - if validate then (checkPathForIllegalChars s) + if validate then + (checkPathForIllegalChars s) let sLen = s.Length @@ -437,7 +439,8 @@ module internal FileSystemUtils = Path.GetFileName(path) let fileNameWithoutExtensionWithValidate (validate: bool) path = - if validate then checkPathForIllegalChars path + if validate then + checkPathForIllegalChars path Path.GetFileNameWithoutExtension(path) @@ -563,7 +566,8 @@ type DefaultFileSystem() as this = let stream = new MemoryMappedStream(mmf, length) - if not stream.CanRead then invalidOp "Cannot read file" + if not stream.CanRead then + invalidOp "Cannot read file" stream :> Stream @@ -881,7 +885,8 @@ type internal ByteStream = } member b.ReadByte() = - if b.pos >= b.max then failwith "end of stream" + if b.pos >= b.max then + failwith "end of stream" let res = b.bytes[b.pos] b.pos <- b.pos + 1 @@ -948,7 +953,8 @@ type internal ByteBuffer = Bytes.blit old 0 buf.bbArray 0 buf.bbCurrent - if buf.useArrayPool then ArrayPool.Shared.Return old + if buf.useArrayPool then + ArrayPool.Shared.Return old member buf.AsMemory() = buf.CheckDisposed() diff --git a/src/Compiler/Utilities/HashMultiMap.fs b/src/Compiler/Utilities/HashMultiMap.fs index cb750676fe3..b88af5d77eb 100644 --- a/src/Compiler/Utilities/HashMultiMap.fs +++ b/src/Compiler/Utilities/HashMultiMap.fs @@ -170,7 +170,8 @@ type internal HashMultiMap<'Key, 'Value>(size: int, comparer: IEqualityComparer< member s.Remove(x) = match s.TryFind x.Key with | Some v -> - if Unchecked.equals v x.Value then s.Remove(x.Key) + if Unchecked.equals v x.Value then + s.Remove(x.Key) true | _ -> false diff --git a/src/Compiler/Utilities/ImmutableArray.fs b/src/Compiler/Utilities/ImmutableArray.fs index 5311efa5e0c..985799856c0 100644 --- a/src/Compiler/Utilities/ImmutableArray.fs +++ b/src/Compiler/Utilities/ImmutableArray.fs @@ -18,7 +18,8 @@ module ImmutableArray = | 0 -> ImmutableArray.Empty | 1 -> ImmutableArray.Create(f 0) | n -> - if n < 0 then invalidArg "n" "Below zero." + if n < 0 then + invalidArg "n" "Below zero." let builder = ImmutableArray.CreateBuilder(n) @@ -180,7 +181,8 @@ module ImmutableArray = let builder = ImmutableArray.CreateBuilder(arr.Length) for i = 0 to arr.Length - 1 do - if predicate arr[i] then builder.Add(arr[i]) + if predicate arr[i] then + builder.Add(arr[i]) builder.Capacity <- builder.Count builder.MoveToImmutable() @@ -199,7 +201,8 @@ module ImmutableArray = for i = 0 to arr.Length - 1 do let result = chooser arr[i] - if result.IsSome then builder.Add(result.Value) + if result.IsSome then + builder.Add(result.Value) builder.Capacity <- builder.Count builder.MoveToImmutable() diff --git a/src/Compiler/Utilities/ResizeArray.fs b/src/Compiler/Utilities/ResizeArray.fs index e96c775f972..cd6e405129c 100644 --- a/src/Compiler/Utilities/ResizeArray.fs +++ b/src/Compiler/Utilities/ResizeArray.fs @@ -26,7 +26,8 @@ module internal ResizeArray = if start2 < 0 then invalidArg "start2" "index must be positive" - if len < 0 then invalidArg "len" "length must be positive" + if len < 0 then + invalidArg "len" "length must be positive" if start1 + len > length arr1 then invalidArg "start1" "(start1+len) out of range" @@ -52,7 +53,8 @@ module internal ResizeArray = if start < 0 then invalidArg "start" "index must be positive" - if len < 0 then invalidArg "len" "length must be positive" + if len < 0 then + invalidArg "len" "length must be positive" if start + len > length arr then invalidArg "len" "length must be positive" @@ -63,7 +65,8 @@ module internal ResizeArray = if start < 0 then invalidArg "start" "index must be positive" - if len < 0 then invalidArg "len" "length must be positive" + if len < 0 then + invalidArg "len" "length must be positive" if start + len > length arr then invalidArg "len" "length must be positive" @@ -203,7 +206,9 @@ module internal ResizeArray = for i = 0 to length arr - 1 do let x = arr[i] - if f x then res.Add(x) + + if f x then + res.Add(x) res diff --git a/src/Compiler/Utilities/illib.fs b/src/Compiler/Utilities/illib.fs index 7d99073da91..3c1172aec7d 100644 --- a/src/Compiler/Utilities/illib.fs +++ b/src/Compiler/Utilities/illib.fs @@ -199,7 +199,8 @@ module Array = let mutable i = 0 while eq && i < len do - if not (inp[i] === res[i]) then eq <- false + if not (inp[i] === res[i]) then + eq <- false i <- i + 1 @@ -1082,9 +1083,11 @@ type MemoizationTable<'T, 'U>(compute: 'T -> 'U, keyComparer: IEqualityComparer< let table = new ConcurrentDictionary<'T, 'U>(keyComparer) member t.Apply x = - if (match canMemoize with - | None -> true - | Some f -> f x) then + if + (match canMemoize with + | None -> true + | Some f -> f x) + then match table.TryGetValue x with | true, res -> res | _ -> diff --git a/src/Compiler/Utilities/range.fs b/src/Compiler/Utilities/range.fs index 035a5de80f4..bbd6a9f0673 100755 --- a/src/Compiler/Utilities/range.fs +++ b/src/Compiler/Utilities/range.fs @@ -343,9 +343,11 @@ type Range(code1: int64, code2: int64) = member m.DebugCode = let name = m.FileName - if name = unknownFileName - || name = startupFileName - || name = commandLineArgsFileName then + if + name = unknownFileName + || name = startupFileName + || name = commandLineArgsFileName + then name else @@ -460,20 +462,26 @@ module Range = else // If all identical then return m1. This preserves NotedSourceConstruct when no merging takes place - if m1.Code1 = m2.Code1 && m1.Code2 = m2.Code2 then + if + m1.Code1 = m2.Code1 && m1.Code2 = m2.Code2 + then m1 else let start = - if (m1.StartLine > m2.StartLine - || (m1.StartLine = m2.StartLine && m1.StartColumn > m2.StartColumn)) then + if + (m1.StartLine > m2.StartLine + || (m1.StartLine = m2.StartLine && m1.StartColumn > m2.StartColumn)) + then m2 else m1 let finish = - if (m1.EndLine > m2.EndLine - || (m1.EndLine = m2.EndLine && m1.EndColumn > m2.EndColumn)) then + if + (m1.EndLine > m2.EndLine + || (m1.EndLine = m2.EndLine && m1.EndColumn > m2.EndColumn)) + then m1 else m2 diff --git a/src/Compiler/Utilities/sformat.fs b/src/Compiler/Utilities/sformat.fs index 2c2a4096573..42b13e28ff9 100644 --- a/src/Compiler/Utilities/sformat.fs +++ b/src/Compiler/Utilities/sformat.fs @@ -632,7 +632,8 @@ module Display = Breaks(next + 1, outer, stack) let popBreak (Breaks (next, outer, stack)) = - if next = 0 then raise (Failure "popBreak: underflow") + if next = 0 then + raise (Failure "popBreak: underflow") let topBroke = stack[next - 1] < 0 @@ -1312,12 +1313,14 @@ module Display = let possibleKeyValueL v = let tyv = v.GetType() - if word = "map" - && (match v with - | null -> false - | _ -> true) - && tyv.IsGenericType - && tyv.GetGenericTypeDefinition() = typedefof> then + if + word = "map" + && (match v with + | null -> false + | _ -> true) + && tyv.IsGenericType + && tyv.GetGenericTypeDefinition() = typedefof> + then nestedObjL depthLim Precedence.BracketIfTuple @@ -1529,8 +1532,10 @@ module Display = "-infinity" elif Double.IsPositiveInfinity(d) then "infinity" - elif opts.FloatingPointFormat[0] = 'g' - && String.forall (fun c -> Char.IsDigit(c) || c = '-') s then + elif + opts.FloatingPointFormat[0] = 'g' + && String.forall (fun c -> Char.IsDigit(c) || c = '-') s + then s + ".0" else s @@ -1545,11 +1550,13 @@ module Display = "-infinity" elif Single.IsPositiveInfinity(d) then "infinity" - elif opts.FloatingPointFormat.Length >= 1 - && opts.FloatingPointFormat[0] = 'g' - && float32 (Int32.MinValue) < d - && d < float32 (Int32.MaxValue) - && float32 (int32 (d)) = d then + elif + opts.FloatingPointFormat.Length >= 1 + && opts.FloatingPointFormat[0] = 'g' + && float32 (Int32.MinValue) < d + && d < float32 (Int32.MaxValue) + && float32 (int32 (d)) = d + then (Convert.ToInt32 d).ToString(opts.FormatProvider) + ".0" else d.ToString(opts.FloatingPointFormat, opts.FormatProvider)) diff --git a/src/FSharp.Build/FSharpEmbedResXSource.fs b/src/FSharp.Build/FSharpEmbedResXSource.fs index 39d44f052eb..4b34660b2a8 100644 --- a/src/FSharp.Build/FSharpEmbedResXSource.fs +++ b/src/FSharp.Build/FSharpEmbedResXSource.fs @@ -41,9 +41,11 @@ module internal {1} = let sourcePath = Path.Combine(_outputPath, justFileName + ".fs") // simple up-to-date check - if File.Exists(resx) - && File.Exists(sourcePath) - && File.GetLastWriteTimeUtc(resx) <= File.GetLastWriteTimeUtc(sourcePath) then + if + File.Exists(resx) + && File.Exists(sourcePath) + && File.GetLastWriteTimeUtc(resx) <= File.GetLastWriteTimeUtc(sourcePath) + then printMessage (sprintf "Skipping generation: '%s' since it is up-to-date." sourcePath) Some(sourcePath) else diff --git a/src/FSharp.Core/QueryExtensions.fs b/src/FSharp.Core/QueryExtensions.fs index f9d0ffd72fb..220618ae563 100644 --- a/src/FSharp.Core/QueryExtensions.fs +++ b/src/FSharp.Core/QueryExtensions.fs @@ -212,7 +212,7 @@ module internal Adapters = type ConversionDescription = | TupleConv of ConversionDescription list | RecordConv of Type * ConversionDescription list - | GroupingConv (* origKeyType: *) of Type (* origElemType: *) * Type * ConversionDescription + | GroupingConv (* origKeyType: *) of Type (* origElemType: *) * Type * ConversionDescription | SeqConv of ConversionDescription | NoConv diff --git a/src/FSharp.Core/array.fs b/src/FSharp.Core/array.fs index 1dff8103bda..8c2fa8470fa 100644 --- a/src/FSharp.Core/array.fs +++ b/src/FSharp.Core/array.fs @@ -17,7 +17,8 @@ open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators module Array = let inline checkNonNull argName arg = - if isNull arg then nullArg argName + if isNull arg then + nullArg argName let inline indexNotFound () = raise (KeyNotFoundException(SR.GetString(SR.keyNotFoundAlt))) @@ -1601,7 +1602,9 @@ module Array = for i = 1 to array.Length - 1 do let curr = array.[i] - if curr < acc then acc <- curr + + if curr < acc then + acc <- curr acc @@ -1636,7 +1639,9 @@ module Array = for i = 1 to array.Length - 1 do let curr = array.[i] - if curr > acc then acc <- curr + + if curr > acc then + acc <- curr acc diff --git a/src/FSharp.Core/async.fs b/src/FSharp.Core/async.fs index 46cd93a84ee..e907040c94c 100644 --- a/src/FSharp.Core/async.fs +++ b/src/FSharp.Core/async.fs @@ -412,7 +412,8 @@ type AsyncActivation<'T>(contents: AsyncActivationContents<'T>) = ok <- true res finally - if not ok then ctxt.OnExceptionRaised() + if not ok then + ctxt.OnExceptionRaised() member ctxt.PostWithTrampoline (syncCtxt: SynchronizationContext) (f: unit -> AsyncReturn) = let holder = contents.aux.trampolineHolder @@ -486,7 +487,8 @@ module AsyncPrimitives = result <- userCode arg ok <- true finally - if not ok then ctxt.OnExceptionRaised() + if not ok then + ctxt.OnExceptionRaised() if ok then AsyncActivation<'T>.HijackCheckThenCall ctxt ctxt.cont result @@ -508,7 +510,8 @@ module AsyncPrimitives = result <- part2 result1 ok <- true finally - if not ok then ctxt.OnExceptionRaised() + if not ok then + ctxt.OnExceptionRaised() if ok then Invoke result ctxt @@ -525,7 +528,8 @@ module AsyncPrimitives = res <- userCode result1 ok <- true finally - if not ok then ctxt.OnExceptionRaised() + if not ok then + ctxt.OnExceptionRaised() if ok then res.Invoke ctxt else fake () @@ -543,7 +547,8 @@ module AsyncPrimitives = resOpt <- filterFunction (edi.GetAssociatedSourceException()) ok <- true finally - if not ok then ctxt.OnExceptionRaised() + if not ok then + ctxt.OnExceptionRaised() if ok then match resOpt with @@ -990,7 +995,9 @@ module AsyncPrimitives = else // In this case the ResultCell has already been disposed, e.g. due to a timeout. // The result is dropped on the floor. - if disposed then + if + disposed + then [] else result <- Some res diff --git a/src/FSharp.Core/eventmodule.fs b/src/FSharp.Core/eventmodule.fs index cd9dc68a76d..fc3c2eabd64 100644 --- a/src/FSharp.Core/eventmodule.fs +++ b/src/FSharp.Core/eventmodule.fs @@ -22,7 +22,11 @@ module Event = [] let filter predicate (sourceEvent: IEvent<'Delegate, 'T>) = let ev = new Event<_>() - sourceEvent.Add(fun x -> if predicate x then ev.Trigger x) + + sourceEvent.Add(fun x -> + if predicate x then + ev.Trigger x) + ev.Publish [] diff --git a/src/FSharp.Core/list.fs b/src/FSharp.Core/list.fs index fbf8089610d..e0dff3d7adb 100644 --- a/src/FSharp.Core/list.fs +++ b/src/FSharp.Core/list.fs @@ -15,7 +15,8 @@ open System.Collections.Generic module List = let inline checkNonNull argName arg = - if isNull arg then nullArg argName + if isNull arg then + nullArg argName let inline indexNotFound () = raise (KeyNotFoundException(SR.GetString(SR.keyNotFoundAlt))) @@ -742,7 +743,8 @@ module List = let mutable acc = h for x in t do - if x > acc then acc <- x + if x > acc then + acc <- x acc @@ -771,7 +773,8 @@ module List = let mutable acc = h for x in t do - if x < acc then acc <- x + if x < acc then + acc <- x acc @@ -910,7 +913,9 @@ module List = match curr with | [] -> invalidArg "index" "index must be within bounds of the list" | h :: t -> - if i < index then coll.Add(h) //items before index we keep + if i < index then + coll.Add(h) //items before index we keep + curr <- t i <- i + 1 diff --git a/src/FSharp.Core/map.fs b/src/FSharp.Core/map.fs index 0d510239f32..9fad005450e 100644 --- a/src/FSharp.Core/map.fs +++ b/src/FSharp.Core/map.fs @@ -1040,7 +1040,8 @@ and KeyCollection<'Key, 'Value when 'Key: comparison>(parent: Map<'Key, 'Value>) parent.ContainsKey x member _.CopyTo(arr, index) = - if isNull arr then nullArg "arr" + if isNull arr then + nullArg "arr" if index < 0 then invalidArg "index" "index must be positive" @@ -1090,7 +1091,8 @@ and ValueCollection<'Key, 'Value when 'Key: comparison>(parent: Map<'Key, 'Value parent.Exists(fun _ value -> Unchecked.equals value x) member _.CopyTo(arr, index) = - if isNull arr then nullArg "arr" + if isNull arr then + nullArg "arr" if index < 0 then invalidArg "index" "index must be positive" diff --git a/src/FSharp.Core/observable.fs b/src/FSharp.Core/observable.fs index d1bcd160313..eb34c62c850 100644 --- a/src/FSharp.Core/observable.fs +++ b/src/FSharp.Core/observable.fs @@ -12,11 +12,12 @@ open Microsoft.FSharp.Control module Observable = let inline protect f succeed fail = - match (try - Choice1Of2(f ()) - with e -> - Choice2Of2 e) - with + match + (try + Choice1Of2(f ()) + with e -> + Choice2Of2 e) + with | Choice1Of2 x -> (succeed x) | Choice2Of2 e -> (fail e) @@ -34,7 +35,8 @@ module Observable = interface IObserver<'T> with member x.OnNext value = - if not stopped then x.Next value + if not stopped then + x.Next value member x.OnError e = if not stopped then @@ -166,7 +168,8 @@ module Observable = source1.Subscribe { new IObserver<'T> with member x.OnNext(v) = - if not stopped then observer.OnNext v + if not stopped then + observer.OnNext v member x.OnError(e) = if not stopped then @@ -186,7 +189,8 @@ module Observable = source2.Subscribe { new IObserver<'T> with member x.OnNext(v) = - if not stopped then observer.OnNext v + if not stopped then + observer.OnNext v member x.OnError(e) = if not stopped then diff --git a/src/FSharp.Core/quotations.fs b/src/FSharp.Core/quotations.fs index a309d9c1816..54ca7e2e3c4 100644 --- a/src/FSharp.Core/quotations.fs +++ b/src/FSharp.Core/quotations.fs @@ -1469,9 +1469,11 @@ module Patterns = else // If a known-number-of-arguments-including-object-argument has been given then check that - if (match knownArgCount with - | ValueNone -> false - | ValueSome n -> n <> (if methInfo.IsStatic then 0 else 1) + nargTs) then + if + (match knownArgCount with + | ValueNone -> false + | ValueSome n -> n <> (if methInfo.IsStatic then 0 else 1) + nargTs) + then false else diff --git a/src/FSharp.Core/reflect.fs b/src/FSharp.Core/reflect.fs index 4bc089765fb..76dbb87c490 100644 --- a/src/FSharp.Core/reflect.fs +++ b/src/FSharp.Core/reflect.fs @@ -1172,10 +1172,12 @@ type FSharpType = // No assembly passed therefore just get framework local version of Tuple let asm = typeof.Assembly - if types - |> Array.exists (function - | null -> true - | _ -> false) then + if + types + |> Array.exists (function + | null -> true + | _ -> false) + then invalidArg "types" (SR.GetString(SR.nullsNotAllowedInArray)) mkTupleType false asm types @@ -1183,10 +1185,12 @@ type FSharpType = static member MakeTupleType(asm: Assembly, types: Type[]) = checkNonNull "types" types - if types - |> Array.exists (function - | null -> true - | _ -> false) then + if + types + |> Array.exists (function + | null -> true + | _ -> false) + then invalidArg "types" (SR.GetString(SR.nullsNotAllowedInArray)) mkTupleType false asm types @@ -1194,10 +1198,12 @@ type FSharpType = static member MakeStructTupleType(asm: Assembly, types: Type[]) = checkNonNull "types" types - if types - |> Array.exists (function - | null -> true - | _ -> false) then + if + types + |> Array.exists (function + | null -> true + | _ -> false) + then invalidArg "types" (SR.GetString(SR.nullsNotAllowedInArray)) mkTupleType true asm types diff --git a/src/FSharp.Core/seq.fs b/src/FSharp.Core/seq.fs index b04ecfa3ec8..18d89ce07f7 100644 --- a/src/FSharp.Core/seq.fs +++ b/src/FSharp.Core/seq.fs @@ -214,7 +214,9 @@ module Internal = member _.Current = box (get ()) member _.MoveNext() = - if not started then started <- true + if not started then + started <- true + curr <- None while (curr.IsNone && e.MoveNext()) do @@ -244,7 +246,9 @@ module Internal = member _.MoveNext() = let rec next () = - if not started then started <- true + if not started then + started <- true + e.MoveNext() && (f e.Current || next ()) next () @@ -304,7 +308,8 @@ module Internal = current <- (Unchecked.defaultof<_>) // cache node unprimed, initialised on demand. let getCurrent () = - if index = unstarted then notStarted () + if index = unstarted then + notStarted () if index = completed then alreadyFinished () @@ -507,7 +512,8 @@ module Internal = interface System.IDisposable with member _.Dispose() = - if not finished then disposeG g + if not finished then + disposeG g // Internal type, used to optimize Enumerator/Generator chains type LazyGeneratorWrappingEnumerator<'T>(e: IEnumerator<'T>) = @@ -791,7 +797,9 @@ module Seq = while (Option.isNone res && e.MoveNext()) do let c = e.Current - if predicate c then res <- Some c + + if predicate c then + res <- Some c res @@ -1316,7 +1324,8 @@ module Seq = let hashSet = HashSet<'T>(HashIdentity.Structural<'T>) for v in source do - if hashSet.Add v then yield v + if hashSet.Add v then + yield v } [] @@ -1484,7 +1493,9 @@ module Seq = while e.MoveNext() do let curr = e.Current - if curr < acc then acc <- curr + + if curr < acc then + acc <- curr acc @@ -1522,7 +1533,9 @@ module Seq = while e.MoveNext() do let curr = e.Current - if curr > acc then acc <- curr + + if curr > acc then + acc <- curr acc @@ -1593,8 +1606,10 @@ module Seq = let mutable ok = false while e.MoveNext() do - if (latest <- e.Current - (ok || not (predicate latest))) then + if + (latest <- e.Current + (ok || not (predicate latest))) + then ok <- true yield latest } @@ -1741,11 +1756,15 @@ module Seq = if e.MoveNext() then let cached = HashSet(itemsToExclude, HashIdentity.Structural) let next = e.Current - if cached.Add next then yield next + + if cached.Add next then + yield next while e.MoveNext() do let next = e.Current - if cached.Add next then yield next + + if cached.Add next then + yield next } [] @@ -1794,7 +1813,9 @@ module Seq = let mutable i = 0 for item in source do - if i <> index then yield item + if i <> index then + yield item + i <- i + 1 if i <= index then @@ -1848,11 +1869,14 @@ module Seq = let mutable i = 0 for item in source do - if i = index then yield value + if i = index then + yield value + yield item i <- i + 1 - if i = index then yield value + if i = index then + yield value if i < index then invalidArg "index" "index must be within bounds of the array" @@ -1867,11 +1891,14 @@ module Seq = let mutable i = 0 for item in source do - if i = index then yield! values + if i = index then + yield! values + yield item i <- i + 1 - if i = index then yield! values // support inserting at the end + if i = index then + yield! values // support inserting at the end if i < index then invalidArg "index" "index must be within bounds of the array" diff --git a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Utilities.fs b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Utilities.fs index 6d2a990efc2..8a1b526837a 100644 --- a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Utilities.fs +++ b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Utilities.fs @@ -308,7 +308,9 @@ module internal Utilities = // Use enabled feeds only (see NuGet.Commands.ListSourceRunner.Run) and strip off the flags. if source.Length > 0 && source.[0] = 'E' then let pos = source.IndexOf(" ") - if pos >= 0 then "i", source.Substring(pos).Trim() + + if pos >= 0 then + "i", source.Substring(pos).Trim() } let computeSha256HashOfBytes (bytes: byte[]) : byte[] = SHA256.Create().ComputeHash(bytes) diff --git a/src/fsc/fscmain.fs b/src/fsc/fscmain.fs index 9eae6cba0e4..ebdf21af60d 100644 --- a/src/fsc/fscmain.fs +++ b/src/fsc/fscmain.fs @@ -26,8 +26,10 @@ let main (argv) = let compilerName = // the 64 bit desktop version of the compiler is name fscAnyCpu.exe, all others are fsc.exe - if Environment.Is64BitProcess - && typeof.Assembly.GetName().Name <> "System.Private.CoreLib" then + if + Environment.Is64BitProcess + && typeof.Assembly.GetName().Name <> "System.Private.CoreLib" + then "fscAnyCpu.exe" else "fsc.exe" diff --git a/src/fsi/console.fs b/src/fsi/console.fs index 05f242990b2..b64849394d3 100644 --- a/src/fsi/console.fs +++ b/src/fsi/console.fs @@ -247,8 +247,10 @@ type internal ReadLineConsole() = checkLeftEdge false let writeChar (c) = - if Console.CursorTop = Console.BufferHeight - 1 - && Console.CursorLeft = Console.BufferWidth - 1 then + if + Console.CursorTop = Console.BufferHeight - 1 + && Console.CursorLeft = Console.BufferWidth - 1 + then //printf "bottom right!\n" anchor <- { anchor with top = (anchor).top - 1 } @@ -278,7 +280,8 @@ type internal ReadLineConsole() = let mutable position = -1 for i = 0 to input.Length - 1 do - if (i = curr) then position <- output.Length + if (i = curr) then + position <- output.Length let c = input.Chars(i) @@ -287,7 +290,8 @@ type internal ReadLineConsole() = else output.Append(c) |> ignore - if (curr = input.Length) then position <- output.Length + if (curr = input.Length) then + position <- output.Length // render the current text, computing a new value for "rendered" let old_rendered = rendered @@ -419,7 +423,8 @@ type internal ReadLineConsole() = if (line = "\x1A") then null else - if (line.Length > 0) then history.AddLast(line) + if (line.Length > 0) then + history.AddLast(line) line diff --git a/src/fsi/fsimain.fs b/src/fsi/fsimain.fs index b94a152c171..ae6513f00cc 100644 --- a/src/fsi/fsimain.fs +++ b/src/fsi/fsimain.fs @@ -411,8 +411,10 @@ let MainMain argv = || x = "/shadowcopyreferences+" || x = "--shadowcopyreferences+") - if AppDomain.CurrentDomain.IsDefaultAppDomain() - && argv |> Array.exists isShadowCopy then + if + AppDomain.CurrentDomain.IsDefaultAppDomain() + && argv |> Array.exists isShadowCopy + then let setupInformation = AppDomain.CurrentDomain.SetupInformation setupInformation.ShadowCopyFiles <- "true" let helper = AppDomain.CreateDomain("FSI_Domain", null, setupInformation) diff --git a/tests/scripts/identifierAnalysisByType.fsx b/tests/scripts/identifierAnalysisByType.fsx new file mode 100644 index 00000000000..7ac8de7a20b --- /dev/null +++ b/tests/scripts/identifierAnalysisByType.fsx @@ -0,0 +1,152 @@ +// Print some stats about identifiers grouped by type +// + +#r "nuget: Ionide.ProjInfo" +#I @"..\..\artifacts\bin\fsc\Debug\net6.0\" +#r "FSharp.Compiler.Service.dll" + +open System +open System.IO +open Ionide.ProjInfo +open FSharp.Compiler.CodeAnalysis +open FSharp.Compiler.Symbols +open Ionide.ProjInfo.Types + +let argv = fsi.CommandLineArgs + +if argv.Length = 1 then + eprintfn "usage:" + eprintfn " dotnet fsi tests/scripts/identifierAnalysisByType.fsx " + eprintfn "" + eprintfn "examples:" + eprintfn " dotnet fsi tests/scripts/identifierAnalysisByType.fsx src/FSharp.Build/FSharp.Build.fsproj" + eprintfn " dotnet fsi tests/scripts/identifierAnalysisByType.fsx src/Compiler/FSharp.Compiler.Service.fsproj" + eprintfn "" + eprintfn "Sample output is at https://gist.github.com/dsyme/abfa11bebf0713251418906d55c08804" + +//let projectFile = Path.Combine(__SOURCE_DIRECTORY__, @"..\..\src\Compiler\FSharp.Compiler.Service.fsproj") +//let projectFile = Path.Combine(__SOURCE_DIRECTORY__, @"..\..\src\FSharp.Build\FSharp.Build.fsproj") +let projectFile = Path.GetFullPath(argv[1]) + +let cwd = System.Environment.CurrentDirectory |> System.IO.DirectoryInfo + +let _toolsPath = Init.init cwd None + +printfn "Cracking project options...." +let opts = + match ProjectLoader.getProjectInfo projectFile [] BinaryLogGeneration.Off [] with + | Result.Ok res -> res + | Result.Error err -> failwithf "%s" err + +let checker = FSharpChecker.Create() + +let checkerOpts = checker.GetProjectOptionsFromCommandLineArgs(projectFile, [| yield! opts.SourceFiles; yield! opts.OtherOptions |] ) + +printfn "Checking project...." +let results = checker.ParseAndCheckProject(checkerOpts) |> Async.RunSynchronously + +printfn "Grouping symbol uses...." +let symbols = results.GetAllUsesOfAllSymbols() + +let rec stripTy (ty: FSharpType) = + if ty.IsAbbreviation then stripTy ty.AbbreviatedType else ty + +let getTypeText (sym: FSharpMemberOrFunctionOrValue) = + let ty = stripTy sym.FullType + FSharpType.Prettify(ty).Format(FSharpDisplayContext.Empty) + +symbols +|> Array.choose (fun vUse -> match vUse.Symbol with :? FSharpMemberOrFunctionOrValue as v -> Some (v, vUse.Range) | _ -> None) +|> Array.filter (fun (v, _) -> v.GenericParameters.Count = 0) +|> Array.filter (fun (v, _) -> v.CurriedParameterGroups.Count = 0) +|> Array.filter (fun (v, _) -> not v.FullType.IsGenericParameter) +|> Array.map (fun (v, vUse) -> getTypeText v, v, vUse) +|> Array.filter (fun (vTypeText, v, _) -> + match vTypeText with + | "System.String" -> false + | "System.Boolean" -> false + | "System.Int32" -> false + | "System.Int64" -> false + | "System.Object" -> false + | "Microsoft.FSharp.Collections.List" -> false + | "Microsoft.FSharp.Core.Option" -> false + | s when s.EndsWith(" Microsoft.FSharp.Core.[]") -> false // for now filter array types + | _ when v.DisplayName.StartsWith "_" -> false + | _ -> true) +|> Array.groupBy (fun (vTypeText, _, _) -> vTypeText) +|> Array.map (fun (key, g) -> + key, + (g + |> Array.groupBy (fun (_, v, _) -> v.DisplayName) + |> Array.sortByDescending (snd >> Array.length))) +|> Array.filter (fun (_, g) -> g.Length > 1) +|> Array.sortByDescending (fun (key, g) -> Array.length g) +|> Array.iter (fun (key, g) -> + let key = key.Replace("Microsoft.FSharp", "FSharp").Replace("FSharp.Core.", "") + printfn "Type: %s" key + for (nm, entries) in g do + printfn " %s (%d times)" nm (Array.length entries) + for (_, _, vUse) in entries do + printfn " %s" (vUse.ToString()) + printfn "") + +(* +let isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) + +let dotnet = + if isWindows then + "dotnet.exe" + else + "dotnet" +let fileExists pathToFile = + try + File.Exists(pathToFile) + with _ -> + false +// Look for global install of dotnet sdk +let getDotnetGlobalHostPath () = + let pf = Environment.GetEnvironmentVariable("ProgramW6432") + + let pf = + if String.IsNullOrEmpty(pf) then + Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + else + pf + + let candidate = Path.Combine(pf, "dotnet", dotnet) + + if fileExists candidate then + Some candidate + else + // Can't find it --- give up + None + +let getDotnetHostPath () = + let probePathForDotnetHost () = + let paths = + let p = Environment.GetEnvironmentVariable("PATH") + + if not (isNull p) then + p.Split(Path.PathSeparator) + else + [||] + + paths |> Array.tryFind (fun f -> fileExists (Path.Combine(f, dotnet))) + + match (Environment.GetEnvironmentVariable("DOTNET_HOST_PATH")) with + // Value set externally + | value when not (String.IsNullOrEmpty(value)) && fileExists value -> Some value + | _ -> + // Probe for netsdk install, dotnet. and dotnet.exe is a constant offset from the location of System.Int32 + let candidate = + let assemblyLocation = Path.GetDirectoryName(typeof.Assembly.Location) + Path.GetFullPath(Path.Combine(assemblyLocation, "..", "..", "..", dotnet)) + + if fileExists candidate then + Some candidate + else + match probePathForDotnetHost () with + | Some f -> Some(Path.Combine(f, dotnet)) + | None -> getDotnetGlobalHostPath () +let dotnetExe = getDotnetHostPath () |> Option.map System.IO.FileInfo +*) diff --git a/vsintegration/tests/UnitTests/QuickInfoTests.fs b/vsintegration/tests/UnitTests/QuickInfoTests.fs index d255f0f3d34..0e65489a70d 100644 --- a/vsintegration/tests/UnitTests/QuickInfoTests.fs +++ b/vsintegration/tests/UnitTests/QuickInfoTests.fs @@ -428,48 +428,35 @@ module Test = Assert.AreEqual(expected, quickInfo) () -[] -let ``Automation.LetBindings.InsideModule``() = - let code = """ +[] -let ``Automation.LetBindings.InsideType.Instance``() = - let code = """ +""">] +[] -let ``Automation.LetBindings.InsideType.Static``() = - let code = """ +""">] +[] +[] +let ``Automation.LetBindings`` code = let expectedSignature = "val func: x: 'a -> unit" let tooltip = GetQuickInfoTextFromCode code From 873eefc2680ec21e86ed8c84be037cec1c29682b Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Tue, 12 Jul 2022 14:11:25 -0700 Subject: [PATCH 05/51] Merge main to release/dev17.4 (#13499) * ValRepInfoForDisplay added for improved quick info for functions defined in expressions * Update * Update QuickInfoTests.fs * Update QuickInfoTests.fs * Update * add identifier analysis script (#13486) * add identifier analysis script * add identifier analysis script * Update fantomas alpha 11 (#13481) * Allow lower-case DU cases when RequireQualifiedAccess is specified (#13432) * Allow lower-case DU cases when RequireQualifiedAccess is specified * Fix PR suggestions and Add more testing * Protect feature under preview version * Add a NotUpperCaseConstructorWithoutRQA warning to be raised in lang version preview * Fix formatting * regularize some names (#13489) * normalize some names * format code * fix build * Subtraction of two chars, new conversions, and fixes for dynamic operator invocations and QuotationToExpression (#11681) Co-authored-by: Vlad Zarytovskii Co-authored-by: Don Syme * Mark backing fields as CompilerGenerated (fixes serialization of fields in FSI multiemit) (#13494) Co-authored-by: Don Syme Co-authored-by: Peter Semkin Co-authored-by: Don Syme Co-authored-by: Florian Verdonck Co-authored-by: Petr Semkin Co-authored-by: Edgar Gonzalez Co-authored-by: Hadrian Tang Co-authored-by: Vlad Zarytovskii Co-authored-by: Kevin Ransom (msft) --- VisualFSharp.sln | 10 +- azure-pipelines.yml | 1 + src/Compiler/AbstractIL/ilreflect.fs | 8 +- src/Compiler/AbstractIL/ilx.fs | 2 +- .../Checking/CheckComputationExpressions.fs | 14 +- src/Compiler/Checking/CheckDeclarations.fs | 94 +- src/Compiler/Checking/CheckDeclarations.fsi | 2 + src/Compiler/Checking/CheckExpressions.fs | 271 +- src/Compiler/Checking/CheckExpressions.fsi | 2 +- src/Compiler/Checking/CheckFormatStrings.fs | 16 +- src/Compiler/Checking/CheckPatterns.fs | 54 +- src/Compiler/Checking/ConstraintSolver.fs | 135 +- src/Compiler/Checking/FindUnsolved.fs | 2 +- src/Compiler/Checking/InfoReader.fs | 22 +- src/Compiler/Checking/InfoReader.fsi | 6 +- src/Compiler/Checking/MethodCalls.fs | 181 +- src/Compiler/Checking/MethodOverrides.fs | 16 +- src/Compiler/Checking/MethodOverrides.fsi | 2 +- src/Compiler/Checking/NameResolution.fs | 16 +- src/Compiler/Checking/NicePrint.fs | 179 +- src/Compiler/Checking/NicePrint.fsi | 19 +- .../Checking/PatternMatchCompilation.fs | 24 +- src/Compiler/Checking/PostInferenceChecks.fs | 41 +- src/Compiler/Checking/QuotationTranslator.fs | 38 +- src/Compiler/Checking/SignatureConformance.fs | 24 +- src/Compiler/Checking/TypeHierarchy.fs | 42 +- src/Compiler/Checking/TypeRelations.fs | 65 +- src/Compiler/Checking/import.fs | 10 +- src/Compiler/Checking/infos.fs | 34 +- src/Compiler/CodeGen/IlxGen.fs | 92 +- src/Compiler/Driver/CompilerDiagnostics.fs | 12 +- src/Compiler/FSComp.txt | 1 + src/Compiler/FSStrings.resx | 3 + src/Compiler/Facilities/LanguageFeatures.fs | 3 + src/Compiler/Facilities/LanguageFeatures.fsi | 1 + src/Compiler/Facilities/TextLayoutRender.fs | 2 +- src/Compiler/Interactive/fsi.fs | 6 +- src/Compiler/Optimize/Optimizer.fs | 26 +- src/Compiler/Service/FSharpCheckerResults.fs | 16 +- src/Compiler/Service/ItemKey.fs | 8 +- .../Service/SemanticClassification.fs | 4 +- .../Service/ServiceDeclarationLists.fs | 59 +- src/Compiler/Service/ServiceNavigation.fs | 124 +- .../Service/ServiceParamInfoLocations.fs | 36 +- src/Compiler/Service/ServiceParsedInputOps.fs | 4 +- src/Compiler/Service/ServiceStructure.fs | 78 +- src/Compiler/Symbols/Exprs.fs | 30 +- src/Compiler/Symbols/SymbolHelpers.fs | 12 +- src/Compiler/Symbols/SymbolPatterns.fs | 8 +- src/Compiler/Symbols/Symbols.fs | 45 +- src/Compiler/SyntaxTree/SyntaxTreeOps.fs | 38 +- src/Compiler/SyntaxTree/SyntaxTreeOps.fsi | 8 +- src/Compiler/TypedTree/TcGlobals.fs | 16 +- src/Compiler/TypedTree/TypedTree.fs | 44 +- src/Compiler/TypedTree/TypedTree.fsi | 10 +- src/Compiler/TypedTree/TypedTreeBasics.fs | 16 +- src/Compiler/TypedTree/TypedTreeBasics.fsi | 8 +- src/Compiler/TypedTree/TypedTreeOps.fs | 327 +-- src/Compiler/TypedTree/TypedTreeOps.fsi | 2 +- src/Compiler/TypedTree/TypedTreePickle.fs | 8 +- src/Compiler/pars.fsy | 218 +- src/Compiler/xlf/FSComp.txt.cs.xlf | 5 + src/Compiler/xlf/FSComp.txt.de.xlf | 5 + src/Compiler/xlf/FSComp.txt.es.xlf | 5 + src/Compiler/xlf/FSComp.txt.fr.xlf | 5 + src/Compiler/xlf/FSComp.txt.it.xlf | 5 + src/Compiler/xlf/FSComp.txt.ja.xlf | 5 + src/Compiler/xlf/FSComp.txt.ko.xlf | 5 + src/Compiler/xlf/FSComp.txt.pl.xlf | 5 + src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 5 + src/Compiler/xlf/FSComp.txt.ru.xlf | 5 + src/Compiler/xlf/FSComp.txt.tr.xlf | 5 + src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 5 + src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 5 + src/Compiler/xlf/FSStrings.cs.xlf | 5 + src/Compiler/xlf/FSStrings.de.xlf | 5 + src/Compiler/xlf/FSStrings.es.xlf | 5 + src/Compiler/xlf/FSStrings.fr.xlf | 5 + src/Compiler/xlf/FSStrings.it.xlf | 5 + src/Compiler/xlf/FSStrings.ja.xlf | 5 + src/Compiler/xlf/FSStrings.ko.xlf | 5 + src/Compiler/xlf/FSStrings.pl.xlf | 5 + src/Compiler/xlf/FSStrings.pt-BR.xlf | 5 + src/Compiler/xlf/FSStrings.ru.xlf | 5 + src/Compiler/xlf/FSStrings.tr.xlf | 5 + src/Compiler/xlf/FSStrings.zh-Hans.xlf | 5 + src/Compiler/xlf/FSStrings.zh-Hant.xlf | 5 + src/FSharp.Core/Linq.fs | 492 ++-- src/FSharp.Core/Linq.fsi | 2 +- src/FSharp.Core/Query.fs | 15 +- src/FSharp.Core/prim-types.fs | 650 +++-- src/FSharp.Core/prim-types.fsi | 4 + src/FSharp.Core/quotations.fs | 8 +- .../E_LowercaseWhenRequireQualifiedAccess.fsx | 22 + .../LowercaseWhenRequireQualifiedAccess.fsx | 44 + .../Conformance/UnionTypes/UnionTypes.fs | 58 + .../GenericComparison/Compare06.fsx.il.bsl | 2 + .../GenericComparison/Equals05.fsx.il.bsl | 2 + .../GenericComparison/Hash08.fsx.il.bsl | 2 + .../EmittedIL/Misc/AnonRecd.fs.il.bsl | 2 + .../TestFunction17.fs.il.debug.bsl | 2 + .../TestFunction17.fs.il.release.bsl | 2 + .../TestFunction24.fs.il.debug.bsl | 2 + .../TestFunction24.fs.il.release.bsl | 2 + .../FSharp.Core.UnitTests.fsproj | 1 + .../FSharp.Core/OperatorsModule1.fs | 98 +- .../FSharp.Core/OperatorsModule2.fs | 119 +- .../FSharp.Core/OperatorsModuleChecked.fs | 34 +- .../FSharp.Core/OperatorsModuleDynamic.fs | 1105 ++++++++ tests/FSharp.Core.UnitTests/SurfaceArea.fs | 1 + tests/FSharp.Test.Utilities/TestFramework.fs | 4 +- tests/fsharp/core/libtest/test.fsx | 40 + .../core/printing/output.1000.stdout.bsl | 53 + .../core/printing/output.200.stdout.bsl | 53 + .../fsharp/core/printing/output.47.stderr.bsl | 108 + .../fsharp/core/printing/output.47.stdout.bsl | 2 +- .../core/printing/output.multiemit.stdout.bsl | 53 + .../core/printing/output.off.stdout.bsl | 53 + .../core/printing/output.quiet.stdout.bsl | 3 + tests/fsharp/core/printing/output.stdout.bsl | 53 + tests/fsharp/core/printing/test.fsx | 40 + tests/fsharp/core/quotes/test.fsx | 2314 +++++++++++++++-- tests/fsharp/tests.fs | 11 +- tests/fsharp/tools/eval/test.fsx | 33 +- tests/scripts/identifierAnalysisByType.fsx | 5 +- tests/service/ExprTests.fs | 46 +- 126 files changed, 6302 insertions(+), 1963 deletions(-) create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/UnionTypes/E_LowercaseWhenRequireQualifiedAccess.fsx create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/UnionTypes/LowercaseWhenRequireQualifiedAccess.fsx create mode 100644 tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleDynamic.fs diff --git a/VisualFSharp.sln b/VisualFSharp.sln index c99c08c29c5..fa4c376c818 100644 --- a/VisualFSharp.sln +++ b/VisualFSharp.sln @@ -84,6 +84,14 @@ EndProject Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Test.Utilities", "tests\FSharp.Test.Utilities\FSharp.Test.Utilities.fsproj", "{60D275B0-B14A-41CB-A1B2-E815A7448FCB}" EndProject Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharpSuite.Tests", "tests\fsharp\FSharpSuite.Tests.fsproj", "{C163E892-5BF7-4B59-AA99-B0E8079C67C4}" + ProjectSection(ProjectDependencies) = postProject + {0973C362-585C-4838-9459-D7E45C6B784B} = {0973C362-585C-4838-9459-D7E45C6B784B} + {37EB3E54-ABC6-4CF5-8273-7CE4B61A42C1} = {37EB3E54-ABC6-4CF5-8273-7CE4B61A42C1} + {511C95D9-3BA6-451F-B6F8-F033F40878A5} = {511C95D9-3BA6-451F-B6F8-F033F40878A5} + {597D9896-4B90-4E9E-9C99-445C2CB9FF60} = {597D9896-4B90-4E9E-9C99-445C2CB9FF60} + {E54456F4-D51A-4334-B225-92EBBED92B40} = {E54456F4-D51A-4334-B225-92EBBED92B40} + {EB015235-1E07-4CDA-9CC6-3FBCC27910D1} = {EB015235-1E07-4CDA-9CC6-3FBCC27910D1} + EndProjectSection EndProject Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.UnitTests", "tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj", "{A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5}" EndProject @@ -149,8 +157,8 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.Service", " EndProject Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.Service.Tests", "tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj", "{14F3D3D6-5C8E-43C2-98A2-17EA704D4DEA}" ProjectSection(ProjectDependencies) = postProject - {FF76BD3C-5E0A-4752-B6C3-044F6E15719B} = {FF76BD3C-5E0A-4752-B6C3-044F6E15719B} {887630A3-4B1D-40EA-B8B3-2D842E9C40DB} = {887630A3-4B1D-40EA-B8B3-2D842E9C40DB} + {FF76BD3C-5E0A-4752-B6C3-044F6E15719B} = {FF76BD3C-5E0A-4752-B6C3-044F6E15719B} EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VisualFSharpDebug", "vsintegration\Vsix\VisualFSharpFull\VisualFSharpDebug.csproj", "{A422D673-8E3B-4924-821B-DD3174173426}" diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 01abb29a8a0..ad5a8657625 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -12,6 +12,7 @@ trigger: exclude: - .github/* - docs/ + - tests/scripts/ - attributions.md - CODE_OF_CONDUCT.md - DEVGUIDE.md diff --git a/src/Compiler/AbstractIL/ilreflect.fs b/src/Compiler/AbstractIL/ilreflect.fs index 2781d8a381a..a37fa6b1ae0 100644 --- a/src/Compiler/AbstractIL/ilreflect.fs +++ b/src/Compiler/AbstractIL/ilreflect.fs @@ -479,11 +479,11 @@ module Zmap = let equalTypes (s: Type) (t: Type) = s.Equals t -let equalTypeLists ss tt = - List.lengthsEqAndForall2 equalTypes ss tt +let equalTypeLists (tys1: Type list) (tys2: Type list) = + List.lengthsEqAndForall2 equalTypes tys1 tys2 -let equalTypeArrays ss tt = - Array.lengthsEqAndForall2 equalTypes ss tt +let equalTypeArrays (tys1: Type[]) (tys2: Type[]) = + Array.lengthsEqAndForall2 equalTypes tys1 tys2 let getGenericArgumentsOfType (typT: Type) = if typT.IsGenericType then diff --git a/src/Compiler/AbstractIL/ilx.fs b/src/Compiler/AbstractIL/ilx.fs index 4eb18649752..e91ad50d712 100644 --- a/src/Compiler/AbstractIL/ilx.fs +++ b/src/Compiler/AbstractIL/ilx.fs @@ -75,7 +75,7 @@ type IlxClosureApps = let rec instAppsAux n inst apps = match apps with | Apps_tyapp (ty, rest) -> Apps_tyapp(instILTypeAux n inst ty, instAppsAux n inst rest) - | Apps_app (dty, rest) -> Apps_app(instILTypeAux n inst dty, instAppsAux n inst rest) + | Apps_app (domainTy, rest) -> Apps_app(instILTypeAux n inst domainTy, instAppsAux n inst rest) | Apps_done retTy -> Apps_done(instILTypeAux n inst retTy) let rec instLambdasAux n inst lambdas = diff --git a/src/Compiler/Checking/CheckComputationExpressions.fs b/src/Compiler/Checking/CheckComputationExpressions.fs index ee42cc97fbe..c8a9501e475 100644 --- a/src/Compiler/Checking/CheckComputationExpressions.fs +++ b/src/Compiler/Checking/CheckComputationExpressions.fs @@ -224,10 +224,10 @@ let TcComputationExpression (cenv: cenv) env (overallTy: OverallTy) tpenv (mWhol // Give bespoke error messages for the FSharp.Core "query" builder let isQuery = match stripDebugPoints interpExpr with - | Expr.Val (vf, _, m) -> - let item = Item.CustomBuilder (vf.DisplayName, vf) + | Expr.Val (vref, _, m) -> + let item = Item.CustomBuilder (vref.DisplayName, vref) CallNameResolutionSink cenv.tcSink (m, env.NameEnv, item, emptyTyparInst, ItemOccurence.Use, env.eAccessRights) - valRefEq cenv.g vf cenv.g.query_value_vref + valRefEq cenv.g vref cenv.g.query_value_vref | _ -> false /// Make a builder.Method(...) call @@ -1909,8 +1909,8 @@ let TcSequenceExpression (cenv: cenv) env tpenv comp (overallTy: OverallTy) m = // This transformation is visible in quotations and thus needs to remain. | (TPat_as (TPat_wild _, PatternValBinding (v, _), _), [_], - DebugPoints(Expr.App (Expr.Val (vf, _, _), _, [genEnumElemTy], [yieldExpr], _mYield), recreate)) - when valRefEq cenv.g vf cenv.g.seq_singleton_vref -> + DebugPoints(Expr.App (Expr.Val (vref, _, _), _, [genEnumElemTy], [yieldExpr], _mYield), recreate)) + when valRefEq cenv.g vref cenv.g.seq_singleton_vref -> // The debug point mFor is attached to the 'map' // The debug point mIn is attached to the lambda @@ -2051,11 +2051,11 @@ let TcSequenceExpression (cenv: cenv) env tpenv comp (overallTy: OverallTy) m = error(Error(FSComp.SR.tcUseForInSequenceExpression(), m)) | SynExpr.Match (spMatch, expr, clauses, _m, _trivia) -> - let inputExpr, matchty, tpenv = TcExprOfUnknownType cenv env tpenv expr + let inputExpr, inputTy, tpenv = TcExprOfUnknownType cenv env tpenv expr let tclauses, tpenv = (tpenv, clauses) ||> List.mapFold (fun tpenv (SynMatchClause(pat, cond, innerComp, _, sp, _)) -> - let patR, condR, vspecs, envinner, tpenv = TcMatchPattern cenv matchty env tpenv pat cond + let patR, condR, vspecs, envinner, tpenv = TcMatchPattern cenv inputTy env tpenv pat cond let envinner = match sp with | DebugPointAtTarget.Yes -> { envinner with eIsControlFlow = true } diff --git a/src/Compiler/Checking/CheckDeclarations.fs b/src/Compiler/Checking/CheckDeclarations.fs index 9fd052bdd4b..b8192ef5f01 100644 --- a/src/Compiler/Checking/CheckDeclarations.fs +++ b/src/Compiler/Checking/CheckDeclarations.fs @@ -291,9 +291,9 @@ let OpenModuleOrNamespaceRefs tcSink g amap scopem root env mvvs openDeclaration env /// Adjust the TcEnv to account for opening a type implied by an `open type` declaration -let OpenTypeContent tcSink g amap scopem env (typ: TType) openDeclaration = +let OpenTypeContent tcSink g amap scopem env (ty: TType) openDeclaration = let env = - { env with eNameResEnv = AddTypeContentsToNameEnv g amap env.eAccessRights scopem env.eNameResEnv typ } + { env with eNameResEnv = AddTypeContentsToNameEnv g amap env.eAccessRights scopem env.eNameResEnv ty } CallEnvSink tcSink (scopem, env.NameEnv, env.eAccessRights) CallOpenDeclarationSink tcSink openDeclaration env @@ -378,6 +378,8 @@ let ImplicitlyOpenOwnNamespace tcSink g amap scopem enclosingNamespacePath (env: exception NotUpperCaseConstructor of range: range +exception NotUpperCaseConstructorWithoutRQA of range: range + let CheckNamespaceModuleOrTypeName (g: TcGlobals) (id: Ident) = // type names '[]' etc. are used in fslib if not g.compilingFSharpCore && id.idText.IndexOfAny IllegalCharactersInTypeAndNamespaceNames <> -1 then @@ -453,7 +455,7 @@ module TcRecdUnionAndEnumDeclarations = // Bind other elements of type definitions (constructors etc.) //------------------------------------------------------------------------- - let CheckUnionCaseName (cenv: cenv) (id: Ident) = + let CheckUnionCaseName (cenv: cenv) (id: Ident) hasRQAAttribute = let g = cenv.g let name = id.idText if name = "Tags" then @@ -461,8 +463,13 @@ module TcRecdUnionAndEnumDeclarations = CheckNamespaceModuleOrTypeName g id - if not (String.isLeadingIdentifierCharacterUpperCase name) && name <> opNameCons && name <> opNameNil then - errorR(NotUpperCaseConstructor(id.idRange)) + if g.langVersion.SupportsFeature(LanguageFeature.LowercaseDUWhenRequireQualifiedAccess) then + + if not (String.isLeadingIdentifierCharacterUpperCase name) && not hasRQAAttribute && name <> opNameCons && name <> opNameNil then + errorR(NotUpperCaseConstructorWithoutRQA(id.idRange)) + else + if not (String.isLeadingIdentifierCharacterUpperCase name) && name <> opNameCons && name <> opNameNil then + errorR(NotUpperCaseConstructor(id.idRange)) let ValidateFieldNames (synFields: SynField list, tastFields: RecdField list) = let seen = Dictionary() @@ -479,13 +486,13 @@ module TcRecdUnionAndEnumDeclarations = | _ -> seen.Add(f.LogicalName, sf)) - let TcUnionCaseDecl (cenv: cenv) env parent thisTy thisTyInst tpenv (SynUnionCase(Attributes synAttrs, SynIdent(id, _), args, xmldoc, vis, m, _)) = + let TcUnionCaseDecl (cenv: cenv) env parent thisTy thisTyInst tpenv hasRQAAttribute (SynUnionCase(Attributes synAttrs, SynIdent(id, _), args, xmldoc, vis, m, _)) = let g = cenv.g let attrs = TcAttributes cenv env AttributeTargets.UnionCaseDecl synAttrs // the attributes of a union case decl get attached to the generated "static factory" method let vis, _ = ComputeAccessAndCompPath env None m vis None parent let vis = CombineReprAccess parent vis - CheckUnionCaseName cenv id + CheckUnionCaseName cenv id hasRQAAttribute let rfields, recordTy = match args with @@ -526,8 +533,8 @@ module TcRecdUnionAndEnumDeclarations = let xmlDoc = xmldoc.ToXmlDoc(true, Some names) Construct.NewUnionCase id rfields recordTy attrs xmlDoc vis - let TcUnionCaseDecls cenv env parent (thisTy: TType) thisTyInst tpenv unionCases = - let unionCasesR = unionCases |> List.map (TcUnionCaseDecl cenv env parent thisTy thisTyInst tpenv) + let TcUnionCaseDecls (cenv: cenv) env (parent: ParentRef) (thisTy: TType) (thisTyInst: TypeInst) hasRQAAttribute tpenv unionCases = + let unionCasesR = unionCases |> List.map (TcUnionCaseDecl cenv env parent thisTy thisTyInst tpenv hasRQAAttribute) unionCasesR |> CheckDuplicates (fun uc -> uc.Id) "union case" let TcEnumDecl cenv env parent thisTy fieldTy (SynEnumCase(attributes=Attributes synAttrs; ident= SynIdent(id,_); value=v; xmlDoc=xmldoc; range=m)) = @@ -658,16 +665,16 @@ let TcOpenTypeDecl (cenv: cenv) mOpenDecl scopem env (synType: SynType, m) = checkLanguageFeatureError g.langVersion LanguageFeature.OpenTypeDeclaration mOpenDecl - let typ, _tpenv = TcType cenv NoNewTypars CheckCxs ItemOccurence.Open env emptyUnscopedTyparEnv synType + let ty, _tpenv = TcType cenv NoNewTypars CheckCxs ItemOccurence.Open env emptyUnscopedTyparEnv synType - if not (isAppTy g typ) then + if not (isAppTy g ty) then error(Error(FSComp.SR.tcNamedTypeRequired("open type"), m)) - if isByrefTy g typ then + if isByrefTy g ty then error(Error(FSComp.SR.tcIllegalByrefsInOpenTypeDeclaration(), m)) - let openDecl = OpenDeclaration.Create (SynOpenDeclTarget.Type (synType, m), [], [typ], scopem, false) - let env = OpenTypeContent cenv.tcSink g cenv.amap scopem env typ openDecl + let openDecl = OpenDeclaration.Create (SynOpenDeclTarget.Type (synType, m), [], [ty], scopem, false) + let env = OpenTypeContent cenv.tcSink g cenv.amap scopem env ty openDecl env, [openDecl] let TcOpenDecl (cenv: cenv) mOpenDecl scopem env target = @@ -1060,7 +1067,7 @@ module MutRecBindingChecking = Phase2BInherit (inheritsExpr, baseValOpt), innerState // Phase2B: let and let rec value and function definitions - | Phase2AIncrClassBindings (tcref, binds, isStatic, isRec, bindsm) -> + | Phase2AIncrClassBindings (tcref, binds, isStatic, isRec, mBinds) -> let envForBinding = if isStatic then envStatic else envInstance let binds, bindRs, env, tpenv = if isRec then @@ -1073,12 +1080,12 @@ module MutRecBindingChecking = else // Type check local binding - let binds, env, tpenv = TcLetBindings cenv envForBinding ExprContainerInfo (ClassLetBinding isStatic) tpenv (binds, bindsm, scopem) + let binds, env, tpenv = TcLetBindings cenv envForBinding ExprContainerInfo (ClassLetBinding isStatic) tpenv (binds, mBinds, scopem) let binds, bindRs = binds |> List.map (function | TMDefLet(bind, _) -> [bind], IncrClassBindingGroup([bind], isStatic, false) - | TMDefDo(e, _) -> [], IncrClassDo(e, isStatic, bindsm) + | TMDefDo(e, _) -> [], IncrClassDo(e, isStatic, mBinds) | _ -> error(InternalError("unexpected definition kind", tcref.Range))) |> List.unzip List.concat binds, bindRs, env, tpenv @@ -1473,7 +1480,7 @@ module MutRecBindingChecking = envForDecls) /// Phase 2: Check the members and 'let' definitions in a mutually recursive group of definitions. - let TcMutRecDefns_Phase2_Bindings (cenv: cenv) envInitial tpenv bindsm scopem mutRecNSInfo (envMutRecPrelimWithReprs: TcEnv) (mutRecDefns: MutRecDefnsPhase2Info) = + let TcMutRecDefns_Phase2_Bindings (cenv: cenv) envInitial tpenv mBinds scopem mutRecNSInfo (envMutRecPrelimWithReprs: TcEnv) (mutRecDefns: MutRecDefnsPhase2Info) = let g = cenv.g let denv = envMutRecPrelimWithReprs.DisplayEnv @@ -1601,12 +1608,12 @@ module MutRecBindingChecking = (fun morpher shape -> shape |> MutRecShapes.iterTyconsAndLets (p23 >> morpher) morpher) MutRecShape.Lets (fun morpher shape -> shape |> MutRecShapes.mapTyconsAndLets (fun (tyconOpt, fixupValueExprBinds, methodBinds) -> tyconOpt, (morpher fixupValueExprBinds @ methodBinds)) morpher) - bindsm + mBinds defnsEs, envMutRec /// Check and generalize the interface implementations, members, 'let' definitions in a mutually recursive group of definitions. -let TcMutRecDefns_Phase2 (cenv: cenv) envInitial bindsm scopem mutRecNSInfo (envMutRec: TcEnv) (mutRecDefns: MutRecDefnsPhase2Data) = +let TcMutRecDefns_Phase2 (cenv: cenv) envInitial mBinds scopem mutRecNSInfo (envMutRec: TcEnv) (mutRecDefns: MutRecDefnsPhase2Data) = let g = cenv.g let interfacesFromTypeDefn envForTycon tyconMembersData = let (MutRecDefnsPhase2DataForTycon(_, _, declKind, tcref, _, _, declaredTyconTypars, members, _, _, _)) = tyconMembersData @@ -1720,7 +1727,7 @@ let TcMutRecDefns_Phase2 (cenv: cenv) envInitial bindsm scopem mutRecNSInfo (env (intfTypes, slotImplSets) ||> List.map2 (interfaceMembersFromTypeDefn tyconData) |> List.concat MutRecDefnsPhase2InfoForTycon(tyconOpt, tcref, declaredTyconTypars, declKind, obinds @ ibinds, fixupFinalAttrs)) - MutRecBindingChecking.TcMutRecDefns_Phase2_Bindings cenv envInitial tpenv bindsm scopem mutRecNSInfo envMutRec binds + MutRecBindingChecking.TcMutRecDefns_Phase2_Bindings cenv envInitial tpenv mBinds scopem mutRecNSInfo envMutRec binds with exn -> errorRecovery exn scopem; [], envMutRec @@ -3188,7 +3195,9 @@ module EstablishTypeDefinitionCores = structLayoutAttributeCheck false noAllowNullLiteralAttributeCheck() - TcRecdUnionAndEnumDeclarations.CheckUnionCaseName cenv unionCaseName + + let hasRQAAttribute = HasFSharpAttribute cenv.g cenv.g.attrib_RequireQualifiedAccessAttribute tycon.Attribs + TcRecdUnionAndEnumDeclarations.CheckUnionCaseName cenv unionCaseName hasRQAAttribute let unionCase = Construct.NewUnionCase unionCaseName [] thisTy [] XmlDoc.Empty tycon.Accessibility writeFakeUnionCtorsToSink [ unionCase ] Construct.MakeUnionRepr [ unionCase ], None, NoSafeInitInfo @@ -3219,8 +3228,9 @@ module EstablishTypeDefinitionCores = noAbstractClassAttributeCheck() noAllowNullLiteralAttributeCheck() structLayoutAttributeCheck false - let unionCases = TcRecdUnionAndEnumDeclarations.TcUnionCaseDecls cenv envinner innerParent thisTy thisTyInst tpenv unionCases - + + let hasRQAAttribute = HasFSharpAttribute cenv.g cenv.g.attrib_RequireQualifiedAccessAttribute tycon.Attribs + let unionCases = TcRecdUnionAndEnumDeclarations.TcUnionCaseDecls cenv envinner innerParent thisTy thisTyInst hasRQAAttribute tpenv unionCases if tycon.IsStructRecordOrUnionTycon && unionCases.Length > 1 then let fieldNames = [ for uc in unionCases do for ft in uc.FieldTable.TrueInstanceFieldsAsList do yield ft.LogicalName ] if fieldNames |> List.distinct |> List.length <> fieldNames.Length then @@ -3426,37 +3436,37 @@ module EstablishTypeDefinitionCores = match stripTyparEqns ty with | TType_anon (_,l) | TType_tuple (_, l) -> accInAbbrevTypes l acc - | TType_ucase (UnionCaseRef(tc, _), tinst) - | TType_app (tc, tinst, _) -> - let tycon2 = tc.Deref + | TType_ucase (UnionCaseRef(tcref2, _), tinst) + | TType_app (tcref2, tinst, _) -> + let tycon2 = tcref2.Deref let acc = accInAbbrevTypes tinst acc // Record immediate recursive references if ListSet.contains (===) tycon2 tycons then (tycon, tycon2) :: acc // Expand the representation of abbreviations - elif tc.IsTypeAbbrev then - accInAbbrevType (reduceTyconRefAbbrev tc tinst) acc + elif tcref2.IsTypeAbbrev then + accInAbbrevType (reduceTyconRefAbbrev tcref2 tinst) acc // Otherwise H - explore the instantiation. else acc - | TType_fun (d, r, _) -> - accInAbbrevType d (accInAbbrevType r acc) + | TType_fun (domainTy, rangeTy, _) -> + accInAbbrevType domainTy (accInAbbrevType rangeTy acc) | TType_var _ -> acc - | TType_forall (_, r) -> accInAbbrevType r acc + | TType_forall (_, bodyTy) -> accInAbbrevType bodyTy acc - | TType_measure ms -> accInMeasure ms acc - - and accInMeasure ms acc = - match stripUnitEqns ms with - | Measure.Con tc when ListSet.contains (===) tc.Deref tycons -> - (tycon, tc.Deref) :: acc - | Measure.Con tc when tc.IsTypeAbbrev -> - accInMeasure (reduceTyconRefAbbrevMeasureable tc) acc + | TType_measure measureTy -> accInMeasure measureTy acc + + and accInMeasure measureTy acc = + match stripUnitEqns measureTy with + | Measure.Const tcref when ListSet.contains (===) tcref.Deref tycons -> + (tycon, tcref.Deref) :: acc + | Measure.Const tcref when tcref.IsTypeAbbrev -> + accInMeasure (reduceTyconRefAbbrevMeasureable tcref) acc | Measure.Prod (ms1, ms2) -> accInMeasure ms1 (accInMeasure ms2 acc) - | Measure.Inv ms -> accInMeasure ms acc + | Measure.Inv invTy -> accInMeasure invTy acc | _ -> acc and accInAbbrevTypes tys acc = @@ -3467,7 +3477,7 @@ module EstablishTypeDefinitionCores = | Some ty -> accInAbbrevType ty [] let edges = List.collect edgesFrom tycons - let graph = Graph ((fun tc -> tc.Stamp), tycons, edges) + let graph = Graph ((fun tycon -> tycon.Stamp), tycons, edges) graph.IterateCycles (fun path -> let tycon = path.Head // The thing is cyclic. Set the abbreviation and representation to be "None" to stop later VS crashes diff --git a/src/Compiler/Checking/CheckDeclarations.fsi b/src/Compiler/Checking/CheckDeclarations.fsi index c4590557ede..631e9fb5812 100644 --- a/src/Compiler/Checking/CheckDeclarations.fsi +++ b/src/Compiler/Checking/CheckDeclarations.fsi @@ -76,3 +76,5 @@ val CheckOneSigFile: Cancellable exception NotUpperCaseConstructor of range: range + +exception NotUpperCaseConstructorWithoutRQA of range: range diff --git a/src/Compiler/Checking/CheckExpressions.fs b/src/Compiler/Checking/CheckExpressions.fs index d513a326a74..7e3baef258b 100644 --- a/src/Compiler/Checking/CheckExpressions.fs +++ b/src/Compiler/Checking/CheckExpressions.fs @@ -987,28 +987,28 @@ let UnifyFunctionType extraInfo cenv denv mFunExpr ty = let ReportImplicitlyIgnoredBoolExpression denv m ty expr = let checkExpr m expr = match stripDebugPoints expr with - | Expr.App (Expr.Val (vf, _, _), _, _, exprs, _) when vf.LogicalName = opNameEquals -> + | Expr.App (Expr.Val (vref, _, _), _, _, exprs, _) when vref.LogicalName = opNameEquals -> match List.map stripDebugPoints exprs with - | Expr.App (Expr.Val (propRef, _, _), _, _, Expr.Val (vf, _, _) :: _, _) :: _ -> + | Expr.App (Expr.Val (propRef, _, _), _, _, Expr.Val (vref, _, _) :: _, _) :: _ -> if propRef.IsPropertyGetterMethod then let propertyName = propRef.PropertyName let hasCorrespondingSetter = match propRef.DeclaringEntity with | Parent entityRef -> entityRef.MembersOfFSharpTyconSorted - |> List.exists (fun valRef -> valRef.IsPropertySetterMethod && valRef.PropertyName = propertyName) + |> List.exists (fun vref -> vref.IsPropertySetterMethod && vref.PropertyName = propertyName) | _ -> false if hasCorrespondingSetter then - UnitTypeExpectedWithPossiblePropertySetter (denv, ty, vf.DisplayName, propertyName, m) + UnitTypeExpectedWithPossiblePropertySetter (denv, ty, vref.DisplayName, propertyName, m) else UnitTypeExpectedWithEquality (denv, ty, m) else UnitTypeExpectedWithEquality (denv, ty, m) - | Expr.Op (TOp.ILCall (_, _, _, _, _, _, _, ilMethRef, _, _, _), _, Expr.Val (vf, _, _) :: _, _) :: _ when ilMethRef.Name.StartsWithOrdinal("get_") -> - UnitTypeExpectedWithPossiblePropertySetter (denv, ty, vf.DisplayName, ChopPropertyName(ilMethRef.Name), m) - | Expr.Val (vf, _, _) :: _ -> - UnitTypeExpectedWithPossibleAssignment (denv, ty, vf.IsMutable, vf.DisplayName, m) + | Expr.Op (TOp.ILCall (_, _, _, _, _, _, _, ilMethRef, _, _, _), _, Expr.Val (vref, _, _) :: _, _) :: _ when ilMethRef.Name.StartsWithOrdinal("get_") -> + UnitTypeExpectedWithPossiblePropertySetter (denv, ty, vref.DisplayName, ChopPropertyName(ilMethRef.Name), m) + | Expr.Val (vref, _, _) :: _ -> + UnitTypeExpectedWithPossibleAssignment (denv, ty, vref.IsMutable, vref.DisplayName, m) | _ -> UnitTypeExpectedWithEquality (denv, ty, m) | _ -> UnitTypeExpected (denv, ty, m) @@ -1041,8 +1041,8 @@ let UnifyUnitType (cenv: cenv) (env: TcEnv) m ty expr = match env.eContextInfo with | ContextInfo.SequenceExpression seqTy -> - let lifted = mkSeqTy g ty - if typeEquiv g seqTy lifted then + let liftedTy = mkSeqTy g ty + if typeEquiv g seqTy liftedTy then warning (Error (FSComp.SR.implicitlyDiscardedInSequenceExpression(NicePrint.prettyStringOfTy denv ty), m)) else if isListTy g ty || isArrayTy g ty || typeEquiv g seqTy ty then @@ -1100,7 +1100,7 @@ let TcConst (cenv: cenv) (overallTy: TType) m env synConst = let _, tcref = ForceRaise(ResolveTypeLongIdent cenv.tcSink cenv.nameResolver ItemOccurence.Use OpenQualified env.eNameResEnv ad tc TypeNameResolutionStaticArgsInfo.DefiniteEmpty PermitDirectReferenceToGeneratedType.No) match tcref.TypeOrMeasureKind with | TyparKind.Type -> error(Error(FSComp.SR.tcExpectedUnitOfMeasureNotType(), m)) - | TyparKind.Measure -> Measure.Con tcref + | TyparKind.Measure -> Measure.Const tcref | SynMeasure.Power(ms, exponent, _) -> Measure.RationalPower (tcMeasure ms, TcSynRationalConst exponent) | SynMeasure.Product(ms1, ms2, _) -> Measure.Prod(tcMeasure ms1, tcMeasure ms2) @@ -1114,7 +1114,7 @@ let TcConst (cenv: cenv) (overallTy: TType) m env synConst = | SynMeasure.Var(_, m) -> error(Error(FSComp.SR.tcNonZeroConstantCannotHaveGenericUnit(), m)) | SynMeasure.Paren(measure, _) -> tcMeasure measure - let unif expected = UnifyTypes cenv env m overallTy expected + let unif expectedTy = UnifyTypes cenv env m overallTy expectedTy let unifyMeasureArg iszero tcr = let measureTy = @@ -1312,7 +1312,7 @@ let MakeMemberDataAndMangledNameForMemberVal(g, tcref, isExtrinsic, attrs, implS // NOTE: This value is initially only set for interface implementations and those overrides // where we manage to pre-infer which abstract is overridden by the method. It is filled in // properly when we check the allImplemented implementation checks at the end of the inference scope. - ImplementedSlotSigs=implSlotTys |> List.map (fun ity -> TSlotSig(logicalName, ity, [], [], [], None)) } + ImplementedSlotSigs=implSlotTys |> List.map (fun intfTy -> TSlotSig(logicalName, intfTy, [], [], [], None)) } let isInstance = MemberIsCompiledAsInstance g tcref isExtrinsic memberInfo attrs @@ -1529,8 +1529,8 @@ let MakeAndPublishVal (cenv: cenv) env (altActualParent, inSig, declKind, valRec let vis = if MemberIsExplicitImpl g memberInfo then let slotSig = List.head memberInfo.ImplementedSlotSigs - match slotSig.ImplementedType with - | TType_app (tyconref, _, _) -> Some tyconref.Accessibility + match slotSig.DeclaringType with + | TType_app (tcref, _, _) -> Some tcref.Accessibility | _ -> None else None @@ -1714,14 +1714,14 @@ let AdjustRecType (v: Val) vscheme = /// Record the generated value expression as a place where we will have to /// adjust using AdjustAndForgetUsesOfRecValue at a letrec point. Every use of a value /// under a letrec gets used at the _same_ type instantiation. -let RecordUseOfRecValue cenv valRecInfo (vrefTgt: ValRef) vexp m = +let RecordUseOfRecValue cenv valRecInfo (vrefTgt: ValRef) vExpr m = match valRecInfo with | ValInRecScope isComplete -> - let fixupPoint = ref vexp + let fixupPoint = ref vExpr cenv.recUses <- cenv.recUses.Add (vrefTgt.Deref, (fixupPoint, m, isComplete)) Expr.Link fixupPoint | ValNotInRecScope -> - vexp + vExpr type RecursiveUseFixupPoints = RecursiveUseFixupPoints of (Expr ref * range) list @@ -2161,9 +2161,9 @@ let rec ApplyUnionCaseOrExn (makerForUnionCase, makerForExnTag) m (cenv: cenv) e let ucref = ucinfo.UnionCaseRef CheckUnionCaseAttributes g ucref m |> CommitOperationResult CheckUnionCaseAccessible cenv.amap m ad ucref |> ignore - let gtyp2 = actualResultTyOfUnionCase ucinfo.TypeInst ucref + let resTy = actualResultTyOfUnionCase ucinfo.TypeInst ucref let inst = mkTyparInst ucref.TyconRef.TyparsNoRange ucinfo.TypeInst - UnifyTypes cenv env m overallTy gtyp2 + UnifyTypes cenv env m overallTy resTy let mkf = makerForUnionCase(ucref, ucinfo.TypeInst) mkf, actualTysOfUnionCaseFields inst ucref, [ for f in ucref.AllFieldsAsList -> f.Id ] | _ -> invalidArg "item" "not a union case or exception reference" @@ -2346,11 +2346,11 @@ module GeneralizationHelpers = let relevantUniqueSubtypeConstraint (tp: Typar) = // Find a single subtype constraint match tp.Constraints |> List.partition (function TyparConstraint.CoercesTo _ -> true | _ -> false) with - | [TyparConstraint.CoercesTo(cxty, _)], others -> + | [TyparConstraint.CoercesTo(tgtTy, _)], others -> // Throw away null constraints if they are implied - if others |> List.exists (function TyparConstraint.SupportsNull _ -> not (TypeSatisfiesNullConstraint g m cxty) | _ -> true) + if others |> List.exists (function TyparConstraint.SupportsNull _ -> not (TypeSatisfiesNullConstraint g m tgtTy) | _ -> true) then None - else Some cxty + else Some tgtTy | _ -> None @@ -2745,8 +2745,8 @@ module EventDeclarationNormalization = let rec private RenameBindingPattern f declPattern = match declPattern with - | SynPat.FromParseError(p, _) -> RenameBindingPattern f p - | SynPat.Typed(pat', _, _) -> RenameBindingPattern f pat' + | SynPat.FromParseError(innerPat, _) -> RenameBindingPattern f innerPat + | SynPat.Typed(innerPat, _, _) -> RenameBindingPattern f innerPat | SynPat.Named (SynIdent(id,_), x2, vis2, m) -> SynPat.Named (SynIdent(ident(f id.idText, id.idRange), None), x2, vis2, m) | SynPat.InstanceMember(thisId, id, toolId, vis2, m) -> SynPat.InstanceMember(thisId, ident(f id.idText, id.idRange), toolId, vis2, m) | _ -> error(Error(FSComp.SR.tcOnlySimplePatternsInLetRec(), declPattern.Range)) @@ -2848,11 +2848,11 @@ let TcValEarlyGeneralizationConsistencyCheck cenv (env: TcEnv) (v: Val, valRecIn match valRecInfo with | ValInRecScope isComplete when isComplete && not (isNil tinst) -> cenv.css.PushPostInferenceCheck (preDefaults=false, check=fun () -> - let tpsorig, tau2 = tryDestForallTy g vTy - if not (isNil tpsorig) then - let tpsorig = NormalizeDeclaredTyparsForEquiRecursiveInference g tpsorig - let tau3 = instType (mkTyparInst tpsorig tinst) tau2 - if not (AddCxTypeEqualsTypeUndoIfFailed env.DisplayEnv cenv.css m tau tau3) then + let vTypars, vTauTy = tryDestForallTy g vTy + if not (isNil vTypars) then + let vTypars = NormalizeDeclaredTyparsForEquiRecursiveInference g vTypars + let vTauTy = instType (mkTyparInst vTypars tinst) vTauTy + if not (AddCxTypeEqualsTypeUndoIfFailed env.DisplayEnv cenv.css m tau vTauTy) then let txt = buildString (fun buf -> NicePrint.outputQualifiedValSpec env.DisplayEnv cenv.infoReader buf (mkLocalValRef v)) error(Error(FSComp.SR.tcInferredGenericTypeGivesRiseToInconsistency(v.DisplayName, txt), m))) | _ -> () @@ -2933,26 +2933,26 @@ let TcVal checkAttributes (cenv: cenv) env (tpenv: UnscopedTyparEnv) (vref: ValR warning(Error(FSComp.SR.tcDoesNotAllowExplicitTypeArguments(v.DisplayName), m)) match valRecInfo with | ValInRecScope false -> - let tpsorig, tau = vref.GeneralizedType - let (tinst: TypeInst), tpenv = checkTys tpenv (tpsorig |> List.map (fun tp -> tp.Kind)) + let vTypars, vTauTy = vref.GeneralizedType + let tinst, tpenv = checkTys tpenv (vTypars |> List.map (fun tp -> tp.Kind)) checkInst tinst - if tpsorig.Length <> tinst.Length then error(Error(FSComp.SR.tcTypeParameterArityMismatch(tpsorig.Length, tinst.Length), m)) + if vTypars.Length <> tinst.Length then error(Error(FSComp.SR.tcTypeParameterArityMismatch(vTypars.Length, tinst.Length), m)) - let tau2 = instType (mkTyparInst tpsorig tinst) tau + let vRecTauTy = instType (mkTyparInst vTypars tinst) vTauTy - (tpsorig, tinst) ||> List.iter2 (fun tp ty -> + (vTypars, tinst) ||> List.iter2 (fun tp ty -> try UnifyTypes cenv env m (mkTyparTy tp) ty - with _ -> error (Recursion(env.DisplayEnv, v.Id, tau2, tau, m))) + with _ -> error (Recursion(env.DisplayEnv, v.Id, vRecTauTy, vTauTy, m))) - tpsorig, vrefFlags, tinst, tau2, tpenv + vTypars, vrefFlags, tinst, vRecTauTy, tpenv | ValInRecScope true | ValNotInRecScope -> - let tpsorig, tps, tpTys, tau = FreshenPossibleForallTy g m TyparRigidity.Flexible vTy + let vTypars, tps, tpTys, vTauTy = FreshenPossibleForallTy g m TyparRigidity.Flexible vTy - let (tinst: TypeInst), tpenv = checkTys tpenv (tps |> List.map (fun tp -> tp.Kind)) + let tinst, tpenv = checkTys tpenv (tps |> List.map (fun tp -> tp.Kind)) checkInst tinst @@ -2960,9 +2960,9 @@ let TcVal checkAttributes (cenv: cenv) env (tpenv: UnscopedTyparEnv) (vref: ValR List.iter2 (UnifyTypes cenv env m) tpTys tinst - TcValEarlyGeneralizationConsistencyCheck cenv env (v, valRecInfo, tinst, vTy, tau, m) + TcValEarlyGeneralizationConsistencyCheck cenv env (v, valRecInfo, tinst, vTy, vTauTy, m) - tpsorig, vrefFlags, tinst, tau, tpenv + vTypars, vrefFlags, tinst, vTauTy, tpenv let exprForVal = Expr.Val (vref, vrefFlags, m) let exprForVal = mkTyAppExpr m (exprForVal, vTy) tinst @@ -3259,7 +3259,7 @@ let BuildILFieldGet g amap m objExpr (finfo: ILFieldInfo) = let isStruct = finfo.IsValueType let boxity = if isStruct then AsValue else AsObject let tinst = finfo.TypeInst - let fieldType = finfo.FieldType (amap, m) + let fieldTy = finfo.FieldType (amap, m) #if !NO_TYPEPROVIDERS let ty = tyOfExpr g objExpr match finfo with @@ -3269,7 +3269,7 @@ let BuildILFieldGet g amap m objExpr (finfo: ILFieldInfo) = | None -> error (Error(FSComp.SR.tcTPFieldMustBeLiteral(), m)) | Some lit -> - Expr.Const (TcFieldInit m lit, m, fieldType) + Expr.Const (TcFieldInit m lit, m, fieldTy) | _ -> #endif let wrap, objExpr, _readonly, _writeonly = mkExprAddrOfExpr g isStruct false NeverMutates objExpr None m @@ -3278,7 +3278,7 @@ let BuildILFieldGet g amap m objExpr (finfo: ILFieldInfo) = // polymorphic code, after inlining etc. * let fspec = mkILFieldSpec(fref, mkILNamedTy boxity fref.DeclaringTypeRef []) // Add an I_nop if this is an initonly field to make sure we never recognize it as an lvalue. See mkExprAddrOfExpr. - wrap (mkAsmExpr (([ mkNormalLdfld fspec ] @ (if finfo.IsInitOnly then [ AI_nop ] else [])), tinst, [objExpr], [fieldType], m)) + wrap (mkAsmExpr (([ mkNormalLdfld fspec ] @ (if finfo.IsInitOnly then [ AI_nop ] else [])), tinst, [objExpr], [fieldTy], m)) /// Checks that setting a field value does not set a literal or initonly field let private CheckFieldLiteralArg (finfo: ILFieldInfo) argExpr m = @@ -3431,28 +3431,28 @@ let AnalyzeArbitraryExprAsEnumerable (cenv: cenv) (env: TcEnv) localAlloc m expr let tryType (exprToSearchForGetEnumeratorAndItem, tyToSearchForGetEnumeratorAndItem) = match findMethInfo true m "GetEnumerator" tyToSearchForGetEnumeratorAndItem with | Exception exn -> Exception exn - | Result getEnumerator_minfo -> + | Result getEnumeratorMethInfo -> - let getEnumerator_minst = FreshenMethInfo m getEnumerator_minfo - let retTypeOfGetEnumerator = getEnumerator_minfo.GetFSharpReturnType(cenv.amap, m, getEnumerator_minst) - if hasArgs getEnumerator_minfo getEnumerator_minst then err true tyToSearchForGetEnumeratorAndItem else + let getEnumeratorMethInst = FreshenMethInfo m getEnumeratorMethInfo + let getEnumeratorRetTy = getEnumeratorMethInfo.GetFSharpReturnType(cenv.amap, m, getEnumeratorMethInst) + if hasArgs getEnumeratorMethInfo getEnumeratorMethInst then err true tyToSearchForGetEnumeratorAndItem else - match findMethInfo false m "MoveNext" retTypeOfGetEnumerator with + match findMethInfo false m "MoveNext" getEnumeratorRetTy with | Exception exn -> Exception exn - | Result moveNext_minfo -> + | Result moveNextMethInfo -> - let moveNext_minst = FreshenMethInfo m moveNext_minfo - let retTypeOfMoveNext = moveNext_minfo.GetFSharpReturnType(cenv.amap, m, moveNext_minst) - if not (typeEquiv g g.bool_ty retTypeOfMoveNext) then err false retTypeOfGetEnumerator else - if hasArgs moveNext_minfo moveNext_minst then err false retTypeOfGetEnumerator else + let moveNextMethInst = FreshenMethInfo m moveNextMethInfo + let moveNextRetTy = moveNextMethInfo.GetFSharpReturnType(cenv.amap, m, moveNextMethInst) + if not (typeEquiv g g.bool_ty moveNextRetTy) then err false getEnumeratorRetTy else + if hasArgs moveNextMethInfo moveNextMethInst then err false getEnumeratorRetTy else - match findMethInfo false m "get_Current" retTypeOfGetEnumerator with + match findMethInfo false m "get_Current" getEnumeratorRetTy with | Exception exn -> Exception exn - | Result get_Current_minfo -> + | Result getCurrentMethInfo -> - let get_Current_minst = FreshenMethInfo m get_Current_minfo - if hasArgs get_Current_minfo get_Current_minst then err false retTypeOfGetEnumerator else - let enumElemTy = get_Current_minfo.GetFSharpReturnType(cenv.amap, m, get_Current_minst) + let getCurrentMethInst = FreshenMethInfo m getCurrentMethInfo + if hasArgs getCurrentMethInfo getCurrentMethInst then err false getEnumeratorRetTy else + let enumElemTy = getCurrentMethInfo.GetFSharpReturnType(cenv.amap, m, getCurrentMethInst) // Compute the element type of the strongly typed enumerator // @@ -3496,23 +3496,23 @@ let AnalyzeArbitraryExprAsEnumerable (cenv: cenv) (env: TcEnv) localAlloc m expr else enumElemTy - let isEnumeratorTypeStruct = isStructTy g retTypeOfGetEnumerator - let originalRetTypeOfGetEnumerator = retTypeOfGetEnumerator + let isEnumeratorTypeStruct = isStructTy g getEnumeratorRetTy + let originalRetTypeOfGetEnumerator = getEnumeratorRetTy - let (enumeratorVar, enumeratorExpr), retTypeOfGetEnumerator = + let (enumeratorVar, enumeratorExpr), getEnumeratorRetTy = if isEnumeratorTypeStruct then if localAlloc then - mkMutableCompGenLocal m "enumerator" retTypeOfGetEnumerator, retTypeOfGetEnumerator + mkMutableCompGenLocal m "enumerator" getEnumeratorRetTy, getEnumeratorRetTy else - let refCellTyForRetTypeOfGetEnumerator = mkRefCellTy g retTypeOfGetEnumerator + let refCellTyForRetTypeOfGetEnumerator = mkRefCellTy g getEnumeratorRetTy let v, e = mkMutableCompGenLocal m "enumerator" refCellTyForRetTypeOfGetEnumerator - (v, mkRefCellGet g m retTypeOfGetEnumerator e), refCellTyForRetTypeOfGetEnumerator + (v, mkRefCellGet g m getEnumeratorRetTy e), refCellTyForRetTypeOfGetEnumerator else - mkCompGenLocal m "enumerator" retTypeOfGetEnumerator, retTypeOfGetEnumerator + mkCompGenLocal m "enumerator" getEnumeratorRetTy, getEnumeratorRetTy let getEnumExpr, getEnumTy = - let getEnumExpr, getEnumTy as res = BuildPossiblyConditionalMethodCall cenv env PossiblyMutates m false getEnumerator_minfo NormalValUse getEnumerator_minst [exprToSearchForGetEnumeratorAndItem] [] + let getEnumExpr, getEnumTy as res = BuildPossiblyConditionalMethodCall cenv env PossiblyMutates m false getEnumeratorMethInfo NormalValUse getEnumeratorMethInst [exprToSearchForGetEnumeratorAndItem] [] if not isEnumeratorTypeStruct || localAlloc then res else // wrap enumerators that are represented as mutable structs into ref cells @@ -3520,8 +3520,8 @@ let AnalyzeArbitraryExprAsEnumerable (cenv: cenv) (env: TcEnv) localAlloc m expr let getEnumTy = mkRefCellTy g getEnumTy getEnumExpr, getEnumTy - let guardExpr, guardTy = BuildPossiblyConditionalMethodCall cenv env DefinitelyMutates m false moveNext_minfo NormalValUse moveNext_minst [enumeratorExpr] [] - let currentExpr, currentTy = BuildPossiblyConditionalMethodCall cenv env DefinitelyMutates m true get_Current_minfo NormalValUse get_Current_minst [enumeratorExpr] [] + let guardExpr, guardTy = BuildPossiblyConditionalMethodCall cenv env DefinitelyMutates m false moveNextMethInfo NormalValUse moveNextMethInst [enumeratorExpr] [] + let currentExpr, currentTy = BuildPossiblyConditionalMethodCall cenv env DefinitelyMutates m true getCurrentMethInfo NormalValUse getCurrentMethInst [enumeratorExpr] [] let currentExpr = mkCoerceExpr(currentExpr, enumElemTy, currentExpr.Range, currentTy) let currentExpr, enumElemTy = // Implicitly dereference byref for expr 'for x in ...' @@ -3531,7 +3531,7 @@ let AnalyzeArbitraryExprAsEnumerable (cenv: cenv) (env: TcEnv) localAlloc m expr else currentExpr, enumElemTy - Result(enumeratorVar, enumeratorExpr, retTypeOfGetEnumerator, enumElemTy, getEnumExpr, getEnumTy, guardExpr, guardTy, currentExpr) + Result(enumeratorVar, enumeratorExpr, getEnumeratorRetTy, enumElemTy, getEnumExpr, getEnumTy, guardExpr, guardTy, currentExpr) // First try the original known static type match (if isArray1DTy g exprTy then Exception (Failure "") else tryType (expr, exprTy)) with @@ -3570,12 +3570,12 @@ let ConvertArbitraryExprToEnumerable (cenv: cenv) ty (env: TcEnv) (expr: Expr) = expr, enumElemTy else let enumerableVar, enumerableExpr = mkCompGenLocal m "inputSequence" ty - let enumeratorVar, _, retTypeOfGetEnumerator, enumElemTy, getEnumExpr, _, guardExpr, guardTy, betterCurrentExpr = + let enumeratorVar, _, getEnumeratorRetTy, enumElemTy, getEnumExpr, _, guardExpr, guardTy, betterCurrentExpr = AnalyzeArbitraryExprAsEnumerable cenv env false m ty enumerableExpr let expr = mkCompGenLet m enumerableVar expr - (mkCallSeqOfFunctions g m retTypeOfGetEnumerator enumElemTy + (mkCallSeqOfFunctions g m getEnumeratorRetTy enumElemTy (mkUnitDelayLambda g m getEnumExpr) (mkLambda m enumeratorVar (guardExpr, guardTy)) (mkLambda m enumeratorVar (betterCurrentExpr, enumElemTy))) @@ -3921,28 +3921,28 @@ let buildApp cenv expr resultTy arg m = match expr, arg with // Special rule for building applications of the 'x && y' operator - | ApplicableExpr(_, Expr.App (Expr.Val (vf, _, _), _, _, [x0], _), _), _ - when valRefEq g vf g.and_vref - || valRefEq g vf g.and2_vref -> + | ApplicableExpr(_, Expr.App (Expr.Val (vref, _, _), _, _, [x0], _), _), _ + when valRefEq g vref g.and_vref + || valRefEq g vref g.and2_vref -> MakeApplicableExprNoFlex cenv (mkLazyAnd g m x0 arg), resultTy // Special rule for building applications of the 'x || y' operator - | ApplicableExpr(_, Expr.App (Expr.Val (vf, _, _), _, _, [x0], _), _), _ - when valRefEq g vf g.or_vref - || valRefEq g vf g.or2_vref -> + | ApplicableExpr(_, Expr.App (Expr.Val (vref, _, _), _, _, [x0], _), _), _ + when valRefEq g vref g.or_vref + || valRefEq g vref g.or2_vref -> MakeApplicableExprNoFlex cenv (mkLazyOr g m x0 arg ), resultTy // Special rule for building applications of the 'reraise' operator - | ApplicableExpr(_, Expr.App (Expr.Val (vf, _, _), _, _, [], _), _), _ - when valRefEq g vf g.reraise_vref -> + | ApplicableExpr(_, Expr.App (Expr.Val (vref, _, _), _, _, [], _), _), _ + when valRefEq g vref g.reraise_vref -> // exprTy is of type: "unit -> 'a". Break it and store the 'a type here, used later as return type. MakeApplicableExprNoFlex cenv (mkCompGenSequential m arg (mkReraise m resultTy)), resultTy // Special rules for NativePtr.ofByRef to generalize result. // See RFC FS-1053.md - | ApplicableExpr(_, Expr.App (Expr.Val (vf, _, _), _, _, [], _), _), _ - when (valRefEq g vf g.nativeptr_tobyref_vref) -> + | ApplicableExpr(_, Expr.App (Expr.Val (vref, _, _), _, _, [], _), _), _ + when (valRefEq g vref g.nativeptr_tobyref_vref) -> let argTy = NewInferenceType g let resultTy = mkByrefTyWithInference g argTy (NewByRefKindInferenceType g m) @@ -3952,10 +3952,10 @@ let buildApp cenv expr resultTy arg m = // address of an expression. // // See also RFC FS-1053.md - | ApplicableExpr(_, Expr.App (Expr.Val (vf, _, _), _, _, [], _), _), _ - when valRefEq g vf g.addrof_vref -> + | ApplicableExpr(_, Expr.App (Expr.Val (vref, _, _), _, _, [], _), _), _ + when valRefEq g vref g.addrof_vref -> - let wrap, e1a', readonly, _writeonly = mkExprAddrOfExpr g true false AddressOfOp arg (Some vf) m + let wrap, e1a', readonly, _writeonly = mkExprAddrOfExpr g true false AddressOfOp arg (Some vref) m // Assert the result type to be readonly if we couldn't take the address let resultTy = let argTy = tyOfExpr g arg @@ -3977,11 +3977,11 @@ let buildApp cenv expr resultTy arg m = // Special rules for building applications of the &&expr' operators, which gets the // address of an expression. - | ApplicableExpr(_, Expr.App (Expr.Val (vf, _, _), _, _, [], _), _), _ - when valRefEq g vf g.addrof2_vref -> + | ApplicableExpr(_, Expr.App (Expr.Val (vref, _, _), _, _, [], _), _), _ + when valRefEq g vref g.addrof2_vref -> warning(UseOfAddressOfOperator m) - let wrap, e1a', _readonly, _writeonly = mkExprAddrOfExpr g true false AddressOfOp arg (Some vf) m + let wrap, e1a', _readonly, _writeonly = mkExprAddrOfExpr g true false AddressOfOp arg (Some vref) m MakeApplicableExprNoFlex cenv (wrap(e1a')), resultTy | _ when isByrefTy g resultTy -> @@ -4598,7 +4598,7 @@ and TcLongIdent kindOpt cenv newOk checkConstraints occ env tpenv synLongId = error(Error(FSComp.SR.tcExpectedUnitOfMeasureNotType(), m)) TType_measure (NewErrorMeasure ()), tpenv | _, TyparKind.Measure -> - TType_measure (Measure.Con tcref), tpenv + TType_measure (Measure.Const tcref), tpenv | _, TyparKind.Type -> TcTypeApp cenv newOk checkConstraints occ env tpenv m tcref tinstEnclosing [] @@ -4631,7 +4631,7 @@ and TcLongIdentAppType kindOpt cenv newOk checkConstraints occ env tpenv longId match args, postfix with | [arg], true -> let ms, tpenv = TcMeasure cenv newOk checkConstraints occ env tpenv arg m - TType_measure (Measure.Prod(Measure.Con tcref, ms)), tpenv + TType_measure (Measure.Prod(Measure.Const tcref, ms)), tpenv | _, _ -> errorR(Error(FSComp.SR.tcUnitsOfMeasureInvalidInTypeConstructor(), m)) @@ -5111,8 +5111,8 @@ and TcNestedTypeApplication cenv newOk checkConstraints occ env tpenv mWholeType /// This means the range of syntactic expression forms that can be used here is limited. and ConvSynPatToSynExpr synPat = match synPat with - | SynPat.FromParseError(p, _) -> - ConvSynPatToSynExpr p + | SynPat.FromParseError(innerPat, _) -> + ConvSynPatToSynExpr innerPat | SynPat.Const (c, m) -> SynExpr.Const (c, m) @@ -5120,8 +5120,8 @@ and ConvSynPatToSynExpr synPat = | SynPat.Named (SynIdent(id,_), _, None, _) -> SynExpr.Ident id - | SynPat.Typed (p, cty, m) -> - SynExpr.Typed (ConvSynPatToSynExpr p, cty, m) + | SynPat.Typed (innerPat, tgtTy, m) -> + SynExpr.Typed (ConvSynPatToSynExpr innerPat, tgtTy, m) | SynPat.LongIdent (longDotId=SynLongIdent(longId, dotms, trivia) as synLongId; argPats=args; accessibility=None; range=m) -> let args = match args with SynArgPats.Pats args -> args | _ -> failwith "impossible: active patterns can be used only with SynConstructorArgs.Pats" @@ -5135,8 +5135,8 @@ and ConvSynPatToSynExpr synPat = | SynPat.Tuple (isStruct, args, m) -> SynExpr.Tuple (isStruct, List.map ConvSynPatToSynExpr args, [], m) - | SynPat.Paren (p, _) -> - ConvSynPatToSynExpr p + | SynPat.Paren (innerPat, _) -> + ConvSynPatToSynExpr innerPat | SynPat.ArrayOrList (isArray, args, m) -> SynExpr.ArrayOrList (isArray,List.map ConvSynPatToSynExpr args, m) @@ -5151,26 +5151,26 @@ and ConvSynPatToSynExpr synPat = error(Error(FSComp.SR.tcInvalidArgForParameterizedPattern(), synPat.Range)) /// Check a long identifier 'Case' or 'Case argsR' that has been resolved to an active pattern case -and TcPatLongIdentActivePatternCase warnOnUpper cenv (env: TcEnv) vFlags patEnv ty (lidRange, item, apref, args, m) = +and TcPatLongIdentActivePatternCase warnOnUpper cenv (env: TcEnv) vFlags patEnv ty (mLongId, item, apref, args, m) = let g = cenv.g let (TcPatLinearEnv(tpenv, names, takenNames)) = patEnv let (APElemRef (apinfo, vref, idx, isStructRetTy)) = apref // Report information about the 'active recognizer' occurrence to IDE - CallNameResolutionSink cenv.tcSink (lidRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Pattern, env.eAccessRights) + CallNameResolutionSink cenv.tcSink (mLongId, env.NameEnv, item, emptyTyparInst, ItemOccurence.Pattern, env.eAccessRights) // TOTAL/PARTIAL ACTIVE PATTERNS - let _, vexp, _, _, tinst, _ = TcVal true cenv env tpenv vref None None m - let vexp = MakeApplicableExprWithFlex cenv env vexp - let vexpty = vexp.Type + let _, vExpr, _, _, tinst, _ = TcVal true cenv env tpenv vref None None m + let vExpr = MakeApplicableExprWithFlex cenv env vExpr + let vExprTy = vExpr.Type let activePatArgsAsSynPats, patArg = match args with | [] -> [], SynPat.Const(SynConst.Unit, m) | _ -> // This bit of type-directed analysis ensures that parameterized partial active patterns returning unit do not need to take an argument - let dtys, retTy = stripFunTy g vexpty + let dtys, retTy = stripFunTy g vExprTy if dtys.Length = args.Length + 1 && ((isOptionTy g retTy && isUnitTy g (destOptionTy g retTy)) || @@ -5189,9 +5189,9 @@ and TcPatLongIdentActivePatternCase warnOnUpper cenv (env: TcEnv) vFlags patEnv let delayed = activePatArgsAsSynExprs - |> List.map (fun arg -> DelayedApp(ExprAtomicFlag.NonAtomic, false, None, arg, unionRanges lidRange arg.Range)) + |> List.map (fun arg -> DelayedApp(ExprAtomicFlag.NonAtomic, false, None, arg, unionRanges mLongId arg.Range)) - let activePatExpr, tpenv = PropagateThenTcDelayed cenv (MustEqual activePatType) env tpenv m vexp vexpty ExprAtomicFlag.NonAtomic delayed + let activePatExpr, tpenv = PropagateThenTcDelayed cenv (MustEqual activePatType) env tpenv m vExpr vExprTy ExprAtomicFlag.NonAtomic delayed let patEnvR = TcPatLinearEnv(tpenv, names, takenNames) @@ -6264,13 +6264,13 @@ and TcExprILAssembly cenv overallTy env tpenv (ilInstrs, synTyArgs, synArgs, syn and RewriteRangeExpr synExpr = match synExpr with // a..b..c (parsed as (a..b)..c ) - | SynExpr.IndexRange(Some (SynExpr.IndexRange(Some synExpr1, _, Some synStepExpr, _, _, _)), _, Some synExpr2, _m1, _m2, wholem) -> - Some (mkSynTrifix wholem ".. .." synExpr1 synStepExpr synExpr2) + | SynExpr.IndexRange(Some (SynExpr.IndexRange(Some synExpr1, _, Some synStepExpr, _, _, _)), _, Some synExpr2, _m1, _m2, mWhole) -> + Some (mkSynTrifix mWhole ".. .." synExpr1 synStepExpr synExpr2) // a..b - | SynExpr.IndexRange (Some synExpr1, mOperator, Some synExpr2, _m1, _m2, wholem) -> + | SynExpr.IndexRange (Some synExpr1, mOperator, Some synExpr2, _m1, _m2, mWhole) -> let otherExpr = match mkSynInfix mOperator synExpr1 ".." synExpr2 with - | SynExpr.App (a, b, c, d, _) -> SynExpr.App (a, b, c, d, wholem) + | SynExpr.App (a, b, c, d, _) -> SynExpr.App (a, b, c, d, mWhole) | _ -> failwith "impossible" Some otherExpr | _ -> None @@ -7696,8 +7696,8 @@ and TcForEachExpr cenv overallTy env tpenv (seqExprOnly, isFromSource, synPat, s match stripDebugPoints enumExpr with // optimize 'for i in n .. m do' - | Expr.App (Expr.Val (vf, _, _), _, [tyarg], [startExpr;finishExpr], _) - when valRefEq g vf g.range_op_vref && typeEquiv g tyarg g.int_ty -> + | Expr.App (Expr.Val (vref, _, _), _, [tyarg], [startExpr;finishExpr], _) + when valRefEq g vref g.range_op_vref && typeEquiv g tyarg g.int_ty -> (g.int32_ty, (fun _ x -> x), id, Choice1Of3 (startExpr, finishExpr)) // optimize 'for i in arr do' @@ -7883,9 +7883,9 @@ and Propagate cenv (overallTy: OverallTy) (env: TcEnv) tpenv (expr: ApplicableEx // See RFC FS-1053.md let isAddrOf = match expr with - | ApplicableExpr(_, Expr.App (Expr.Val (vf, _, _), _, _, [], _), _) - when (valRefEq g vf g.addrof_vref || - valRefEq g vf g.nativeptr_tobyref_vref) -> true + | ApplicableExpr(_, Expr.App (Expr.Val (vref, _, _), _, _, [], _), _) + when (valRefEq g vref g.addrof_vref || + valRefEq g vref g.nativeptr_tobyref_vref) -> true | _ -> false propagate isAddrOf delayedList' mExprAndArg resultTy @@ -8195,12 +8195,12 @@ and TcApplicationThen cenv (overallTy: OverallTy) env tpenv mExprAndArg synLeftE // will have debug points on "f expr1" and "g expr2" let env = match leftExpr with - | ApplicableExpr(_, Expr.Val (vf, _, _), _) - | ApplicableExpr(_, Expr.App (Expr.Val (vf, _, _), _, _, [_], _), _) - when valRefEq g vf g.and_vref - || valRefEq g vf g.and2_vref - || valRefEq g vf g.or_vref - || valRefEq g vf g.or2_vref -> + | ApplicableExpr(_, Expr.Val (vref, _, _), _) + | ApplicableExpr(_, Expr.App (Expr.Val (vref, _, _), _, _, [_], _), _) + when valRefEq g vref g.and_vref + || valRefEq g vref g.and2_vref + || valRefEq g vref g.or_vref + || valRefEq g vref g.or2_vref -> { env with eIsControlFlow = true } | _ -> env @@ -8757,7 +8757,7 @@ and TcValueItemThen cenv overallTy env vref tpenv mItem afterResolution delayed vTy // Always allow subsumption on assignment to fields let expr2R, tpenv = TcExprFlex cenv true false vty2 env tpenv expr2 - let vexp = + let vExpr = if isInByrefTy g vTy then errorR(Error(FSComp.SR.writeToReadOnlyByref(), mStmt)) mkAddrSet mStmt vref expr2R @@ -8766,7 +8766,7 @@ and TcValueItemThen cenv overallTy env vref tpenv mItem afterResolution delayed else mkValSet mStmt vref expr2R - PropagateThenTcDelayed cenv overallTy env tpenv mStmt (MakeApplicableExprNoFlex cenv vexp) (tyOfExpr g vexp) ExprAtomicFlag.NonAtomic otherDelayed + PropagateThenTcDelayed cenv overallTy env tpenv mStmt (MakeApplicableExprNoFlex cenv vExpr) (tyOfExpr g vExpr) ExprAtomicFlag.NonAtomic otherDelayed // Value instantiation: v ... | DelayedTypeApp(tys, _mTypeArgs, mExprAndTypeArgs) :: otherDelayed -> @@ -8780,24 +8780,24 @@ and TcValueItemThen cenv overallTy env vref tpenv mItem afterResolution delayed match tys with | [SynType.Var(SynTypar(id, _, false) as tp, _m)] -> let _tpR, tpenv = TcTypeOrMeasureParameter None cenv env ImplicitlyBoundTyparsAllowed.NoNewTypars tpenv tp - let vexp = TcNameOfExprResult cenv id mExprAndTypeArgs - let vexpFlex = MakeApplicableExprNoFlex cenv vexp + let vExpr = TcNameOfExprResult cenv id mExprAndTypeArgs + let vexpFlex = MakeApplicableExprNoFlex cenv vExpr PropagateThenTcDelayed cenv overallTy env tpenv mExprAndTypeArgs vexpFlex g.string_ty ExprAtomicFlag.Atomic otherDelayed | _ -> error (Error(FSComp.SR.expressionHasNoName(), mExprAndTypeArgs)) | _ -> let checkTys tpenv kinds = TcTypesOrMeasures (Some kinds) cenv NewTyparsOK CheckCxs ItemOccurence.UseInType env tpenv tys mItem - let _, vexp, isSpecial, _, _, tpenv = TcVal true cenv env tpenv vref (Some (NormalValUse, checkTys)) (Some afterResolution) mItem + let _, vExpr, isSpecial, _, _, tpenv = TcVal true cenv env tpenv vref (Some (NormalValUse, checkTys)) (Some afterResolution) mItem - let vexpFlex = (if isSpecial then MakeApplicableExprNoFlex cenv vexp else MakeApplicableExprWithFlex cenv env vexp) + let vexpFlex = (if isSpecial then MakeApplicableExprNoFlex cenv vExpr else MakeApplicableExprWithFlex cenv env vExpr) // We need to eventually record the type resolution for an expression, but this is done // inside PropagateThenTcDelayed, so we don't have to explicitly call 'CallExprHasTypeSink' here PropagateThenTcDelayed cenv overallTy env tpenv mExprAndTypeArgs vexpFlex vexpFlex.Type ExprAtomicFlag.Atomic otherDelayed // Value get | _ -> - let _, vexp, isSpecial, _, _, tpenv = TcVal true cenv env tpenv vref None (Some afterResolution) mItem - let vexpFlex = (if isSpecial then MakeApplicableExprNoFlex cenv vexp else MakeApplicableExprWithFlex cenv env vexp) + let _, vExpr, isSpecial, _, _, tpenv = TcVal true cenv env tpenv vref None (Some afterResolution) mItem + let vexpFlex = (if isSpecial then MakeApplicableExprNoFlex cenv vExpr else MakeApplicableExprWithFlex cenv env vExpr) PropagateThenTcDelayed cenv overallTy env tpenv mItem vexpFlex vexpFlex.Type ExprAtomicFlag.Atomic delayed and TcPropertyItemThen cenv overallTy env nm pinfos tpenv mItem afterResolution delayed = @@ -9054,8 +9054,8 @@ and TcLookupThen cenv overallTy env tpenv mObjExpr objExpr objExprTy longId dela PropagateThenTcDelayed cenv overallTy env tpenv mExprAndItem (MakeApplicableExprWithFlex cenv env objExpr') fieldTy ExprAtomicFlag.Atomic delayed | Item.AnonRecdField (anonInfo, tinst, n, _) -> - let tgty = TType_anon (anonInfo, tinst) - AddCxTypeMustSubsumeType ContextInfo.NoContext env.DisplayEnv cenv.css mItem NoTrace tgty objExprTy + let tgtTy = TType_anon (anonInfo, tinst) + AddCxTypeMustSubsumeType ContextInfo.NoContext env.DisplayEnv cenv.css mItem NoTrace tgtTy objExprTy let fieldTy = List.item n tinst match delayed with | DelayedSet _ :: _otherDelayed -> @@ -9107,7 +9107,7 @@ and TcEventItemThen cenv overallTy env tpenv mItem mExprAndItem objDetails (einf MethInfoChecks g cenv.amap true None objArgs env.eAccessRights mItem delInvokeMeth // This checks for and drops the 'object' sender - let argsTy = ArgsTypOfEventInfo cenv.infoReader mItem ad einfo + let argsTy = ArgsTypeOfEventInfo cenv.infoReader mItem ad einfo if not (slotSigHasVoidReturnTy (delInvokeMeth.GetSlotSig(cenv.amap, mItem))) then errorR (nonStandardEventError einfo.EventName mItem) let delEventTy = mkIEventType g delTy argsTy @@ -11264,14 +11264,13 @@ and AnalyzeRecursiveDecl let rec analyzeRecursiveDeclPat tpenv pat = match pat with - | SynPat.FromParseError(pat', _) -> analyzeRecursiveDeclPat tpenv pat' - | SynPat.Typed(pat', cty, _) -> - let ctyR, tpenv = TcTypeAndRecover cenv NewTyparsOK CheckCxs ItemOccurence.UseInType envinner tpenv cty + | SynPat.FromParseError(innerPat, _) -> analyzeRecursiveDeclPat tpenv innerPat + | SynPat.Typed(innerPat, tgtTy, _) -> + let ctyR, tpenv = TcTypeAndRecover cenv NewTyparsOK CheckCxs ItemOccurence.UseInType envinner tpenv tgtTy UnifyTypes cenv envinner mBinding ty ctyR - analyzeRecursiveDeclPat tpenv pat' - | SynPat.Attrib(_pat', _attribs, m) -> + analyzeRecursiveDeclPat tpenv innerPat + | SynPat.Attrib(_innerPat, _attribs, m) -> error(Error(FSComp.SR.tcAttributesInvalidInPatterns(), m)) - //analyzeRecursiveDeclPat pat' // This is for the construct 'let rec x = ... and do ... and y = ...' (DEPRECATED IN pars.mly ) // diff --git a/src/Compiler/Checking/CheckExpressions.fsi b/src/Compiler/Checking/CheckExpressions.fsi index 8b5f1878532..2a83a61d50f 100644 --- a/src/Compiler/Checking/CheckExpressions.fsi +++ b/src/Compiler/Checking/CheckExpressions.fsi @@ -1180,7 +1180,7 @@ val TcPatLongIdentActivePatternCase: vFlags: TcPatValFlags -> patEnv: TcPatLinearEnv -> ty: TType -> - lidRange: range * item: Item * apref: ActivePatternElemRef * args: SynPat list * m: range -> + mLongId: range * item: Item * apref: ActivePatternElemRef * args: SynPat list * m: range -> (TcPatPhase2Input -> Pattern) * TcPatLinearEnv /// The pattern syntax can also represent active pattern arguments. This routine diff --git a/src/Compiler/Checking/CheckFormatStrings.fs b/src/Compiler/Checking/CheckFormatStrings.fs index fb4b4cec03a..1334b1bf54c 100644 --- a/src/Compiler/Checking/CheckFormatStrings.fs +++ b/src/Compiler/Checking/CheckFormatStrings.fs @@ -22,9 +22,9 @@ let copyAndFixupFormatTypar m tp = let lowestDefaultPriority = 0 (* See comment on TyparConstraint.DefaultsTo *) -let mkFlexibleFormatTypar m tys dflt = +let mkFlexibleFormatTypar m tys dfltTy = let tp = Construct.NewTypar (TyparKind.Type, TyparRigidity.Rigid, SynTypar(mkSynId m "fmt",TyparStaticReq.HeadType,true),false,TyparDynamicReq.Yes,[],false,false) - tp.SetConstraints [ TyparConstraint.SimpleChoice (tys,m); TyparConstraint.DefaultsTo (lowestDefaultPriority,dflt,m)] + tp.SetConstraints [ TyparConstraint.SimpleChoice (tys,m); TyparConstraint.DefaultsTo (lowestDefaultPriority,dfltTy,m)] copyAndFixupFormatTypar m tp let mkFlexibleIntFormatTypar (g: TcGlobals) m = @@ -449,19 +449,19 @@ let parseFormatStringInternal | Some '+' -> collectSpecifierLocation fragLine fragCol 1 let i = skipPossibleInterpolationHole (i+1) - let xty = NewInferenceType g - percentATys.Add(xty) - parseLoop ((posi, xty) :: acc) (i, fragLine, fragCol+1) fragments + let aTy = NewInferenceType g + percentATys.Add(aTy) + parseLoop ((posi, aTy) :: acc) (i, fragLine, fragCol+1) fragments | Some n -> failwith (FSComp.SR.forDoesNotSupportPrefixFlag(ch.ToString(), n.ToString())) | 'a' -> checkOtherFlags ch - let xty = NewInferenceType g - let fty = mkFunTy g printerArgTy (mkFunTy g xty printerResidueTy) + let aTy = NewInferenceType g + let fTy = mkFunTy g printerArgTy (mkFunTy g aTy printerResidueTy) collectSpecifierLocation fragLine fragCol 2 let i = skipPossibleInterpolationHole (i+1) - parseLoop ((Option.map ((+)1) posi, xty) :: (posi, fty) :: acc) (i, fragLine, fragCol+1) fragments + parseLoop ((Option.map ((+)1) posi, aTy) :: (posi, fTy) :: acc) (i, fragLine, fragCol+1) fragments | 't' -> checkOtherFlags ch diff --git a/src/Compiler/Checking/CheckPatterns.fs b/src/Compiler/Checking/CheckPatterns.fs index b39d6481517..7ced746b6a1 100644 --- a/src/Compiler/Checking/CheckPatterns.fs +++ b/src/Compiler/Checking/CheckPatterns.fs @@ -503,7 +503,7 @@ and TcPatLongIdent warnOnUpper cenv env ad valReprInfo vFlags (patEnv: TcPatLine | SynArgPats.Pats [] -> warnOnUpper | _ -> AllIdsOK - let lidRange = rangeOfLid longId + let mLongId = rangeOfLid longId match ResolvePatternLongIdent cenv.tcSink cenv.nameResolver warnOnUpperForId false m ad env.NameEnv TypeNameResolutionInfo.Default longId with | Item.NewDef id -> @@ -519,19 +519,19 @@ and TcPatLongIdent warnOnUpper cenv env ad valReprInfo vFlags (patEnv: TcPatLine let args = GetSynArgPatterns args - TcPatLongIdentActivePatternCase warnOnUpper cenv env vFlags patEnv ty (lidRange, item, apref, args, m) + TcPatLongIdentActivePatternCase warnOnUpper cenv env vFlags patEnv ty (mLongId, item, apref, args, m) | Item.UnionCase _ | Item.ExnCase _ as item -> - TcPatLongIdentUnionCaseOrExnCase warnOnUpper cenv env ad vFlags patEnv ty (lidRange, item, args, m) + TcPatLongIdentUnionCaseOrExnCase warnOnUpper cenv env ad vFlags patEnv ty (mLongId, item, args, m) | Item.ILField finfo -> - TcPatLongIdentILField warnOnUpper cenv env vFlags patEnv ty (lidRange, finfo, args, m) + TcPatLongIdentILField warnOnUpper cenv env vFlags patEnv ty (mLongId, finfo, args, m) | Item.RecdField rfinfo -> - TcPatLongIdentRecdField warnOnUpper cenv env vFlags patEnv ty (lidRange, rfinfo, args, m) + TcPatLongIdentRecdField warnOnUpper cenv env vFlags patEnv ty (mLongId, rfinfo, args, m) | Item.Value vref -> - TcPatLongIdentLiteral warnOnUpper cenv env vFlags patEnv ty (lidRange, vref, args, m) + TcPatLongIdentLiteral warnOnUpper cenv env vFlags patEnv ty (mLongId, vref, args, m) | _ -> error (Error(FSComp.SR.tcRequireVarConstRecogOrLiteral(), m)) @@ -577,9 +577,9 @@ and ApplyUnionCaseOrExn m (cenv: cenv) env overallTy item = let ucref = ucinfo.UnionCaseRef CheckUnionCaseAttributes g ucref m |> CommitOperationResult CheckUnionCaseAccessible cenv.amap m ad ucref |> ignore - let gtyp2 = actualResultTyOfUnionCase ucinfo.TypeInst ucref + let resTy = actualResultTyOfUnionCase ucinfo.TypeInst ucref let inst = mkTyparInst ucref.TyconRef.TyparsNoRange ucinfo.TypeInst - UnifyTypes cenv env m overallTy gtyp2 + UnifyTypes cenv env m overallTy resTy let mkf mArgs args = TPat_unioncase(ucref, ucinfo.TypeInst, args, unionRanges m mArgs) mkf, actualTysOfUnionCaseFields inst ucref, [ for f in ucref.AllFieldsAsList -> f.Id ] @@ -587,11 +587,11 @@ and ApplyUnionCaseOrExn m (cenv: cenv) env overallTy item = invalidArg "item" "not a union case or exception reference" /// Check a long identifier 'Case' or 'Case argsR that has been resolved to a union case or F# exception constructor -and TcPatLongIdentUnionCaseOrExnCase warnOnUpper cenv env ad vFlags patEnv ty (lidRange, item, args, m) = +and TcPatLongIdentUnionCaseOrExnCase warnOnUpper cenv env ad vFlags patEnv ty (mLongId, item, args, m) = let g = cenv.g // Report information about the case occurrence to IDE - CallNameResolutionSink cenv.tcSink (lidRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Pattern, env.eAccessRights) + CallNameResolutionSink cenv.tcSink (mLongId, env.NameEnv, item, emptyTyparInst, ItemOccurence.Pattern, env.eAccessRights) let mkf, argTys, argNames = ApplyUnionCaseOrExn m cenv env ty item let numArgTys = argTys.Length @@ -693,38 +693,38 @@ and TcPatLongIdentUnionCaseOrExnCase warnOnUpper cenv env ad vFlags patEnv ty (l (fun values -> mkf m (List.map (fun f -> f values) argsR)), acc /// Check a long identifier that has been resolved to an IL field - valid if a literal -and TcPatLongIdentILField warnOnUpper (cenv: cenv) env vFlags patEnv ty (lidRange, finfo, args, m) = +and TcPatLongIdentILField warnOnUpper (cenv: cenv) env vFlags patEnv ty (mLongId, finfo, args, m) = let g = cenv.g - CheckILFieldInfoAccessible g cenv.amap lidRange env.AccessRights finfo + CheckILFieldInfoAccessible g cenv.amap mLongId env.AccessRights finfo if not finfo.IsStatic then - errorR (Error (FSComp.SR.tcFieldIsNotStatic finfo.FieldName, lidRange)) + errorR (Error (FSComp.SR.tcFieldIsNotStatic finfo.FieldName, mLongId)) CheckILFieldAttributes g finfo m match finfo.LiteralValue with | None -> - error (Error (FSComp.SR.tcFieldNotLiteralCannotBeUsedInPattern (), lidRange)) + error (Error (FSComp.SR.tcFieldNotLiteralCannotBeUsedInPattern (), mLongId)) | Some lit -> CheckNoArgsForLiteral args m let _, acc = TcArgPats warnOnUpper cenv env vFlags patEnv args UnifyTypes cenv env m ty (finfo.FieldType (cenv.amap, m)) - let c' = TcFieldInit lidRange lit + let c' = TcFieldInit mLongId lit let item = Item.ILField finfo - CallNameResolutionSink cenv.tcSink (lidRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Pattern, env.AccessRights) + CallNameResolutionSink cenv.tcSink (mLongId, env.NameEnv, item, emptyTyparInst, ItemOccurence.Pattern, env.AccessRights) (fun _ -> TPat_const (c', m)), acc /// Check a long identifier that has been resolved to a record field -and TcPatLongIdentRecdField warnOnUpper cenv env vFlags patEnv ty (lidRange, rfinfo, args, m) = +and TcPatLongIdentRecdField warnOnUpper cenv env vFlags patEnv ty (mLongId, rfinfo, args, m) = let g = cenv.g - CheckRecdFieldInfoAccessible cenv.amap lidRange env.AccessRights rfinfo - if not rfinfo.IsStatic then errorR (Error (FSComp.SR.tcFieldIsNotStatic(rfinfo.DisplayName), lidRange)) - CheckRecdFieldInfoAttributes g rfinfo lidRange |> CommitOperationResult + CheckRecdFieldInfoAccessible cenv.amap mLongId env.AccessRights rfinfo + if not rfinfo.IsStatic then errorR (Error (FSComp.SR.tcFieldIsNotStatic(rfinfo.DisplayName), mLongId)) + CheckRecdFieldInfoAttributes g rfinfo mLongId |> CommitOperationResult match rfinfo.LiteralValue with - | None -> error (Error(FSComp.SR.tcFieldNotLiteralCannotBeUsedInPattern(), lidRange)) + | None -> error (Error(FSComp.SR.tcFieldNotLiteralCannotBeUsedInPattern(), mLongId)) | Some lit -> CheckNoArgsForLiteral args m let _, acc = TcArgPats warnOnUpper cenv env vFlags patEnv args @@ -733,26 +733,26 @@ and TcPatLongIdentRecdField warnOnUpper cenv env vFlags patEnv ty (lidRange, rfi let item = Item.RecdField rfinfo // FUTURE: can we do better than emptyTyparInst here, in order to display instantiations // of type variables in the quick info provided in the IDE. - CallNameResolutionSink cenv.tcSink (lidRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Pattern, env.AccessRights) + CallNameResolutionSink cenv.tcSink (mLongId, env.NameEnv, item, emptyTyparInst, ItemOccurence.Pattern, env.AccessRights) (fun _ -> TPat_const (lit, m)), acc /// Check a long identifier that has been resolved to an F# value that is a literal -and TcPatLongIdentLiteral warnOnUpper (cenv: cenv) env vFlags patEnv ty (lidRange, vref, args, m) = +and TcPatLongIdentLiteral warnOnUpper (cenv: cenv) env vFlags patEnv ty (mLongId, vref, args, m) = let g = cenv.g let (TcPatLinearEnv(tpenv, _, _)) = patEnv match vref.LiteralValue with | None -> error (Error(FSComp.SR.tcNonLiteralCannotBeUsedInPattern(), m)) | Some lit -> - let _, _, _, vexpty, _, _ = TcVal true cenv env tpenv vref None None lidRange - CheckValAccessible lidRange env.AccessRights vref - CheckFSharpAttributes g vref.Attribs lidRange |> CommitOperationResult + let _, _, _, vexpty, _, _ = TcVal true cenv env tpenv vref None None mLongId + CheckValAccessible mLongId env.AccessRights vref + CheckFSharpAttributes g vref.Attribs mLongId |> CommitOperationResult CheckNoArgsForLiteral args m let _, acc = TcArgPats warnOnUpper cenv env vFlags patEnv args UnifyTypes cenv env m ty vexpty let item = Item.Value vref - CallNameResolutionSink cenv.tcSink (lidRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Pattern, env.AccessRights) + CallNameResolutionSink cenv.tcSink (mLongId, env.NameEnv, item, emptyTyparInst, ItemOccurence.Pattern, env.AccessRights) (fun _ -> TPat_const (lit, m)), acc and TcPatterns warnOnUpper cenv env vFlags s argTys args = diff --git a/src/Compiler/Checking/ConstraintSolver.fs b/src/Compiler/Checking/ConstraintSolver.fs index 7d7097dc25a..dd9fd013553 100644 --- a/src/Compiler/Checking/ConstraintSolver.fs +++ b/src/Compiler/Checking/ConstraintSolver.fs @@ -136,12 +136,12 @@ let FreshenTypars m tpsorig = match tpsorig with | [] -> [] | _ -> - let _, _, tptys = FreshenTypeInst m tpsorig - tptys + let _, _, tpTys = FreshenTypeInst m tpsorig + tpTys let FreshenMethInfo m (minfo: MethInfo) = - let _, _, tptys = FreshMethInst m (minfo.GetFormalTyparsOfDeclaringType m) minfo.DeclaringTypeInst minfo.FormalMethodTypars - tptys + let _, _, tpTys = FreshMethInst m (minfo.GetFormalTyparsOfDeclaringType m) minfo.DeclaringTypeInst minfo.FormalMethodTypars + tpTys //------------------------------------------------------------------------- // Unification of types: solve/record equality constraints @@ -362,7 +362,7 @@ let rec occursCheck g un ty = | TType_app (_, l, _) | TType_anon(_, l) | TType_tuple (_, l) -> List.exists (occursCheck g un) l - | TType_fun (d, r, _) -> occursCheck g un d || occursCheck g un r + | TType_fun (domainTy, rangeTy, _) -> occursCheck g un domainTy || occursCheck g un rangeTy | TType_var (r, _) -> typarEq un r | TType_forall (_, tau) -> occursCheck g un tau | _ -> false @@ -428,7 +428,7 @@ let isFpTy g ty = /// decimal or decimal<_> let isDecimalTy g ty = - typeEquivAux EraseMeasures g g.decimal_ty ty + typeEquivAux EraseMeasures g g.decimal_ty ty let IsNonDecimalNumericOrIntegralEnumType g ty = IsIntegerOrIntegerEnumTy g ty || isFpTy g ty @@ -443,7 +443,7 @@ let IsRelationalType g ty = IsNumericType g ty || isStringTy g ty || isCharTy g let IsCharOrStringType g ty = isCharTy g ty || isStringTy g ty /// Checks the argument type for a built-in solution to an op_Addition, op_Subtraction or op_Modulus constraint. -let IsAddSubModType nm g ty = IsNumericOrIntegralEnumType g ty || (nm = "op_Addition" && IsCharOrStringType g ty) +let IsAddSubModType nm g ty = IsNumericOrIntegralEnumType g ty || (nm = "op_Addition" && IsCharOrStringType g ty) || (nm = "op_Subtraction" && isCharTy g ty) /// Checks the argument type for a built-in solution to a bitwise operator constraint let IsBitwiseOpType g ty = IsIntegerOrIntegerEnumTy g ty || (isEnumTy g ty) @@ -787,7 +787,7 @@ let UnifyMeasureWithOne (csenv: ConstraintSolverEnv) trace ms = match FindPreferredTypar nonRigidVars with | (v, e) :: vs -> let unexpandedCons = ListMeasureConOccsWithNonZeroExponents csenv.g false ms - let newms = ProdMeasures (List.map (fun (c, e') -> Measure.RationalPower (Measure.Con c, NegRational (DivRational e' e))) unexpandedCons + let newms = ProdMeasures (List.map (fun (c, e') -> Measure.RationalPower (Measure.Const c, NegRational (DivRational e' e))) unexpandedCons @ List.map (fun (v, e') -> Measure.RationalPower (Measure.Var v, NegRational (DivRational e' e))) (vs @ rigidVars)) SubstMeasureWarnIfRigid csenv trace v newms @@ -818,7 +818,7 @@ let SimplifyMeasure g vars ms = let newms = ProdMeasures [ for (c, e') in nonZeroCon do - Measure.RationalPower (Measure.Con c, NegRational (DivRational e' e)) + Measure.RationalPower (Measure.Const c, NegRational (DivRational e' e)) for (v', e') in nonZeroVar do if typarEq v v' then newvarExpr @@ -841,11 +841,11 @@ let rec SimplifyMeasuresInType g resultFirst (generalizable, generalized as para | TType_anon (_,l) | TType_tuple (_, l) -> SimplifyMeasuresInTypes g param l - | TType_fun (d, r, _) -> + | TType_fun (domainTy, rangeTy, _) -> if resultFirst then - SimplifyMeasuresInTypes g param [r;d] + SimplifyMeasuresInTypes g param [rangeTy;domainTy] else - SimplifyMeasuresInTypes g param [d;r] + SimplifyMeasuresInTypes g param [domainTy;rangeTy] | TType_var _ -> param @@ -886,7 +886,7 @@ let rec GetMeasureVarGcdInType v ty = | TType_anon (_,l) | TType_tuple (_, l) -> GetMeasureVarGcdInTypes v l - | TType_fun (d, r, _) -> GcdRational (GetMeasureVarGcdInType v d) (GetMeasureVarGcdInType v r) + | TType_fun (domainTy, rangeTy, _) -> GcdRational (GetMeasureVarGcdInType v domainTy) (GetMeasureVarGcdInType v rangeTy) | TType_var _ -> ZeroRational | TType_forall (_, tau) -> GetMeasureVarGcdInType v tau | TType_measure unt -> MeasureVarExponent v unt @@ -1027,7 +1027,7 @@ and solveTypMeetsTyparConstraints (csenv: ConstraintSolverEnv) ndeep m2 trace ty AddConstraint csenv ndeep m2 trace destTypar (TyparConstraint.DefaultsTo(priority, dty, m)) | TyparConstraint.SupportsNull m2 -> SolveTypeUseSupportsNull csenv ndeep m2 trace ty - | TyparConstraint.IsEnum(underlying, m2) -> SolveTypeIsEnum csenv ndeep m2 trace ty underlying + | TyparConstraint.IsEnum(underlyingTy, m2) -> SolveTypeIsEnum csenv ndeep m2 trace ty underlyingTy | TyparConstraint.SupportsComparison(m2) -> SolveTypeSupportsComparison csenv ndeep m2 trace ty | TyparConstraint.SupportsEquality(m2) -> SolveTypeSupportsEquality csenv ndeep m2 trace ty | TyparConstraint.IsDelegate(aty, bty, m2) -> SolveTypeIsDelegate csenv ndeep m2 trace ty aty bty @@ -1054,17 +1054,17 @@ and SolveTyparEqualsType (csenv: ConstraintSolverEnv) ndeep m2 (trace: OptionalT } // Like SolveTyparEqualsType but asserts all typar equalities simultaneously instead of one by one -and SolveTyparsEqualTypes (csenv: ConstraintSolverEnv) ndeep m2 (trace: OptionalTrace) tptys tys = trackErrors { - do! (tptys, tys) ||> Iterate2D (fun tpty ty -> - match tpty with +and SolveTyparsEqualTypes (csenv: ConstraintSolverEnv) ndeep m2 (trace: OptionalTrace) tpTys tys = trackErrors { + do! (tpTys, tys) ||> Iterate2D (fun tpTy ty -> + match tpTy with | TType_var (r, _) | TType_measure (Measure.Var r) -> - SolveTyparEqualsTypePart1 csenv m2 trace tpty r ty + SolveTyparEqualsTypePart1 csenv m2 trace tpTy r ty | _ -> failwith "SolveTyparsEqualTypes") - do! (tptys, tys) ||> Iterate2D (fun tpty ty -> - match tpty with + do! (tpTys, tys) ||> Iterate2D (fun tpTy ty -> + match tpTy with | TType_var (r, _) | TType_measure (Measure.Var r) -> SolveTyparEqualsTypePart2 csenv ndeep m2 trace r ty @@ -1135,7 +1135,7 @@ and SolveTypeEqualsType (csenv: ConstraintSolverEnv) ndeep m2 (trace: OptionalTr match sty1, sty2 with // type vars inside forall-types may be alpha-equivalent - | TType_var (tp1, _), TType_var (tp2, _) when typarEq tp1 tp2 || (match aenv.EquivTypars.TryFind tp1 with | Some v when typeEquiv g v ty2 -> true | _ -> false) -> + | TType_var (tp1, _), TType_var (tp2, _) when typarEq tp1 tp2 || (match aenv.EquivTypars.TryFind tp1 with | Some tpTy1 when typeEquiv g tpTy1 ty2 -> true | _ -> false) -> CompleteD // 'v1 = 'v2 @@ -1173,18 +1173,18 @@ and SolveTypeEqualsType (csenv: ConstraintSolverEnv) ndeep m2 (trace: OptionalTr SolveAnonInfoEqualsAnonInfo csenv m2 anonInfo1 anonInfo2 ++ (fun () -> SolveTypeEqualsTypeEqns csenv ndeep m2 trace None l1 l2) - | TType_fun (d1, r1, _), TType_fun (d2, r2, _) -> - SolveFunTypeEqn csenv ndeep m2 trace None d1 d2 r1 r2 + | TType_fun (domainTy1, rangeTy1, _), TType_fun (domainTy2, rangeTy2, _) -> + SolveFunTypeEqn csenv ndeep m2 trace None domainTy1 domainTy2 rangeTy1 rangeTy2 | TType_measure ms1, TType_measure ms2 -> UnifyMeasures csenv trace ms1 ms2 - | TType_forall(tps1, rty1), TType_forall(tps2, rty2) -> + | TType_forall(tps1, bodyTy1), TType_forall(tps2, bodyTy2) -> if tps1.Length <> tps2.Length then localAbortD else let aenv = aenv.BindEquivTypars tps1 tps2 let csenv = {csenv with EquivEnv = aenv } if not (typarsAEquiv g aenv tps1 tps2) then localAbortD else - SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace rty1 rty2 + SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace bodyTy1 bodyTy2 | TType_ucase (uc1, l1), TType_ucase (uc2, l2) when g.unionCaseRefEq uc1 uc2 -> SolveTypeEqualsTypeEqns csenv ndeep m2 trace None l1 l2 | _ -> localAbortD @@ -1214,9 +1214,9 @@ and SolveTypeEqualsTypeEqns csenv ndeep m2 trace cxsln origl1 origl2 = ErrorD(ConstraintSolverTupleDiffLengths(csenv.DisplayEnv, origl1, origl2, csenv.m, m2)) loop origl1 origl2 -and SolveFunTypeEqn csenv ndeep m2 trace cxsln d1 d2 r1 r2 = trackErrors { - do! SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln d1 d2 - return! SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln r1 r2 +and SolveFunTypeEqn csenv ndeep m2 trace cxsln domainTy1 domainTy2 rangeTy1 rangeTy2 = trackErrors { + do! SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln domainTy1 domainTy2 + return! SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln rangeTy1 rangeTy2 } // ty1: expected @@ -1240,7 +1240,7 @@ and SolveTypeSubsumesType (csenv: ConstraintSolverEnv) ndeep m2 (trace: Optional match sty1, sty2 with | TType_var (tp1, _), _ -> match aenv.EquivTypars.TryFind tp1 with - | Some v -> SolveTypeSubsumesType csenv ndeep m2 trace cxsln v ty2 + | Some tpTy1 -> SolveTypeSubsumesType csenv ndeep m2 trace cxsln tpTy1 ty2 | _ -> match sty2 with | TType_var (r2, _) when typarEq tp1 r2 -> CompleteD @@ -1258,8 +1258,8 @@ and SolveTypeSubsumesType (csenv: ConstraintSolverEnv) ndeep m2 (trace: Optional SolveAnonInfoEqualsAnonInfo csenv m2 anonInfo1 anonInfo2 ++ (fun () -> SolveTypeEqualsTypeEqns csenv ndeep m2 trace cxsln l1 l2) (* nb. can unify since no variance *) - | TType_fun (d1, r1, _), TType_fun (d2, r2, _) -> - SolveFunTypeEqn csenv ndeep m2 trace cxsln d1 d2 r1 r2 (* nb. can unify since no variance *) + | TType_fun (domainTy1, rangeTy1, _), TType_fun (domainTy2, rangeTy2, _) -> + SolveFunTypeEqn csenv ndeep m2 trace cxsln domainTy1 domainTy2 rangeTy1 rangeTy2 (* nb. can unify since no variance *) | TType_measure ms1, TType_measure ms2 -> UnifyMeasures csenv trace ms1 ms2 @@ -1306,17 +1306,17 @@ and SolveTypeSubsumesType (csenv: ConstraintSolverEnv) ndeep m2 (trace: Optional // Note we don't support co-variance on array types nor // the special .NET conversions for these types match ty1 with - | AppTy g (tcr1, tinst) when + | AppTy g (tcref1, tinst1) when isArray1DTy g ty2 && - (tyconRefEq g tcr1 g.tcref_System_Collections_Generic_IList || - tyconRefEq g tcr1 g.tcref_System_Collections_Generic_ICollection || - tyconRefEq g tcr1 g.tcref_System_Collections_Generic_IReadOnlyList || - tyconRefEq g tcr1 g.tcref_System_Collections_Generic_IReadOnlyCollection || - tyconRefEq g tcr1 g.tcref_System_Collections_Generic_IEnumerable) -> - match tinst with - | [ty1arg] -> - let ty2arg = destArrayTy g ty2 - SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln ty1arg ty2arg + (tyconRefEq g tcref1 g.tcref_System_Collections_Generic_IList || + tyconRefEq g tcref1 g.tcref_System_Collections_Generic_ICollection || + tyconRefEq g tcref1 g.tcref_System_Collections_Generic_IReadOnlyList || + tyconRefEq g tcref1 g.tcref_System_Collections_Generic_IReadOnlyCollection || + tyconRefEq g tcref1 g.tcref_System_Collections_Generic_IEnumerable) -> + match tinst1 with + | [elemTy1] -> + let elemTy2 = destArrayTy g ty2 + SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln elemTy1 elemTy2 | _ -> error(InternalError("destArrayTy", m)) | _ -> @@ -1525,13 +1525,13 @@ and SolveMemberConstraint (csenv: ConstraintSolverEnv) ignoreUnresolvedOverload if rankOfArrayTy g ty <> argTys.Length - 1 then do! ErrorD(ConstraintSolverError(FSComp.SR.csIndexArgumentMismatch((rankOfArrayTy g ty), (argTys.Length - 1)), m, m2)) - let argTys, ety = List.frontAndBack argTys + let argTys, lastTy = List.frontAndBack argTys for argTy in argTys do do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy g.int_ty - let etys = destArrayTy g ty - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace ety etys + let elemTy = destArrayTy g ty + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace lastTy elemTy return TTraitBuiltIn | [], _, false, ("op_BitwiseAnd" | "op_BitwiseOr" | "op_ExclusiveOr"), [argTy1;argTy2] @@ -1601,25 +1601,30 @@ and SolveMemberConstraint (csenv: ConstraintSolverEnv) ignoreUnresolvedOverload do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy return TTraitBuiltIn - | _, _, false, "op_Explicit", [argTy] - when (// The input type. + // Conversions from non-decimal numbers / strings / chars to non-decimal numbers / chars are built-in + | _, _, false, "op_Explicit", [argTy] + when (// The input type. (IsNonDecimalNumericOrIntegralEnumType g argTy || isStringTy g argTy || isCharTy g argTy) && // The output type - (IsNonDecimalNumericOrIntegralEnumType g retTy || isCharTy g retTy) && - // Exclusion: IntPtr and UIntPtr do not support .Parse() from string - not (isStringTy g argTy && isNativeIntegerTy g retTy) && - // Exclusion: No conversion from char to decimal - not (isCharTy g argTy && isDecimalTy g retTy)) -> + (IsNonDecimalNumericOrIntegralEnumType g retTy || isCharTy g retTy)) -> return TTraitBuiltIn - - | _, _, false, "op_Explicit", [argTy] - when (// The input type. - (IsNumericOrIntegralEnumType g argTy || isStringTy g argTy) && + // Conversions from (including decimal) numbers / strings / chars to decimals are built-in + | _, _, false, "op_Explicit", [argTy] + when (// The input type. + (IsNumericOrIntegralEnumType g argTy || isStringTy g argTy || isCharTy g argTy) && // The output type - (isDecimalTy g retTy)) -> + (isDecimalTy g retTy)) -> + return TTraitBuiltIn + // Conversions from decimal numbers to native integers are built-in + // The rest of decimal conversions are handled via op_Explicit lookup on System.Decimal (which also looks for op_Implicit) + | _, _, false, "op_Explicit", [argTy] + when (// The input type. + (isDecimalTy g argTy) && + // The output type + (isNativeIntegerTy g retTy)) -> return TTraitBuiltIn | [], _, false, "Pow", [argTy1; argTy2] @@ -1845,10 +1850,10 @@ and MemberConstraintSolutionOfMethInfo css m minfo minst = match callMethInfoOpt, callExpr with | Some methInfo, Expr.Op (TOp.ILCall (_, _, _, _, NormalValUse, _, _, ilMethRef, _, methInst, _), [], args, m) when (args, (objArgVars@allArgVars)) ||> List.lengthsEqAndForall2 (fun a b -> match a with Expr.Val (v, _, _) -> valEq v.Deref b | _ -> false) -> - let declaringType = ImportProvidedType amap m (methInfo.PApply((fun x -> x.DeclaringType), m)) - if isILAppTy g declaringType then + let declaringTy = ImportProvidedType amap m (methInfo.PApply((fun x -> x.DeclaringType), m)) + if isILAppTy g declaringTy then let extOpt = None // EXTENSION METHODS FROM TYPE PROVIDERS: for extension methods coming from the type providers we would have something here. - ILMethSln(declaringType, extOpt, ilMethRef, methInst) + ILMethSln(declaringTy, extOpt, ilMethRef, methInst) else closedExprSln | _ -> @@ -2090,8 +2095,8 @@ and AddConstraint (csenv: ConstraintSolverEnv) ndeep m2 trace tp newConstraint | TyparConstraint.IsReferenceType _, TyparConstraint.IsReferenceType _ | TyparConstraint.RequiresDefaultConstructor _, TyparConstraint.RequiresDefaultConstructor _ -> true | TyparConstraint.SimpleChoice (tys1, _), TyparConstraint.SimpleChoice (tys2, _) -> ListSet.isSubsetOf (typeEquiv g) tys1 tys2 - | TyparConstraint.DefaultsTo (priority1, dty1, _), TyparConstraint.DefaultsTo (priority2, dty2, _) -> - (priority1 = priority2) && typeEquiv g dty1 dty2 + | TyparConstraint.DefaultsTo (priority1, defaultTy1, _), TyparConstraint.DefaultsTo (priority2, defaultTy2, _) -> + (priority1 = priority2) && typeEquiv g defaultTy1 defaultTy2 | _ -> false @@ -2565,14 +2570,12 @@ and SolveTypeSubsumesTypeWithWrappedContextualReport (csenv: ConstraintSolverEnv and SolveTypeSubsumesTypeWithReport (csenv: ConstraintSolverEnv) ndeep m trace cxsln ty1 ty2 = SolveTypeSubsumesTypeWithWrappedContextualReport csenv ndeep m trace cxsln ty1 ty2 id -// ty1: actual -// ty2: expected -and private SolveTypeEqualsTypeWithReport (csenv: ConstraintSolverEnv) ndeep m trace cxsln actual expected = +and SolveTypeEqualsTypeWithReport (csenv: ConstraintSolverEnv) ndeep m trace cxsln actualTy expectedTy = TryD - (fun () -> SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m trace cxsln actual expected) + (fun () -> SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m trace cxsln actualTy expectedTy) (function | AbortForFailedMemberConstraintResolution as err -> ErrorD err - | res -> ErrorD (ErrorFromAddingTypeEquation(csenv.g, csenv.DisplayEnv, actual, expected, res, m))) + | res -> ErrorD (ErrorFromAddingTypeEquation(csenv.g, csenv.DisplayEnv, actualTy, expectedTy, res, m))) and ArgsMustSubsumeOrConvert (csenv: ConstraintSolverEnv) diff --git a/src/Compiler/Checking/FindUnsolved.fs b/src/Compiler/Checking/FindUnsolved.fs index a914e61d256..93f452abd7d 100644 --- a/src/Compiler/Checking/FindUnsolved.fs +++ b/src/Compiler/Checking/FindUnsolved.fs @@ -201,7 +201,7 @@ and accDiscrim cenv env d = | DecisionTreeTest.ArrayLength(_, ty) -> accTy cenv env ty | DecisionTreeTest.Const _ | DecisionTreeTest.IsNull -> () - | DecisionTreeTest.IsInst (srcty, tgty) -> accTy cenv env srcty; accTy cenv env tgty + | DecisionTreeTest.IsInst (srcTy, tgtTy) -> accTy cenv env srcTy; accTy cenv env tgtTy | DecisionTreeTest.ActivePatternCase (exp, tys, _, _, _, _) -> accExpr cenv env exp accTypeInst cenv env tys diff --git a/src/Compiler/Checking/InfoReader.fs b/src/Compiler/Checking/InfoReader.fs index 75a4e9aa897..581cb7d0353 100644 --- a/src/Compiler/Checking/InfoReader.fs +++ b/src/Compiler/Checking/InfoReader.fs @@ -628,10 +628,10 @@ type InfoReader(g: TcGlobals, amap: Import.ImportMap) as this = keyComparer= { new System.Collections.Generic.IEqualityComparer<_> with - member _.Equals((flags1, _, typ1), (flags2, _, typ2)) = + member _.Equals((flags1, _, ty1), (flags2, _, ty2)) = // Ignoring the ranges - that's OK. flagsEq.Equals(flags1, flags2) && - match stripTyEqns g typ1, stripTyEqns g typ2 with + match stripTyEqns g ty1, stripTyEqns g ty2 with | TType_app(tcref1, [], _), TType_app(tcref2, [], _) -> tyconRefEq g tcref1 tcref2 | _ -> false member _.GetHashCode((flags, _, ty)) = @@ -910,11 +910,11 @@ type SigOfFunctionForDelegate = /// Given a delegate type work out the minfo, argument types, return type /// and F# function type by looking at the Invoke signature of the delegate. -let GetSigOfFunctionForDelegate (infoReader: InfoReader) delty m ad = +let GetSigOfFunctionForDelegate (infoReader: InfoReader) delTy m ad = let g = infoReader.g let amap = infoReader.amap let delInvokeMeth = - match GetIntrinsicMethInfosOfType infoReader (Some "Invoke") ad AllowMultiIntfInstantiations.Yes IgnoreOverrides m delty with + match GetIntrinsicMethInfosOfType infoReader (Some "Invoke") ad AllowMultiIntfInstantiations.Yes IgnoreOverrides m delTy with | [h] -> h | [] -> error(Error(FSComp.SR.noInvokeMethodsFound (), m)) | h :: _ -> warning(InternalError(FSComp.SR.moreThanOneInvokeMethodFound (), m)); h @@ -964,26 +964,26 @@ let TryDestStandardDelegateType (infoReader: InfoReader) m ad delTy = // already defined an appropriate delegate type: EventHandler. // (from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vcwlkEventsTutorial.asp) let IsStandardEventInfo (infoReader: InfoReader) m ad (einfo: EventInfo) = - let dty = einfo.GetDelegateType(infoReader.amap, m) - match TryDestStandardDelegateType infoReader m ad dty with + let delTy = einfo.GetDelegateType(infoReader.amap, m) + match TryDestStandardDelegateType infoReader m ad delTy with | Some _ -> true | None -> false /// Get the (perhaps tupled) argument type accepted by an event -let ArgsTypOfEventInfo (infoReader: InfoReader) m ad (einfo: EventInfo) = +let ArgsTypeOfEventInfo (infoReader: InfoReader) m ad (einfo: EventInfo) = let amap = infoReader.amap - let dty = einfo.GetDelegateType(amap, m) - match TryDestStandardDelegateType infoReader m ad dty with + let delTy = einfo.GetDelegateType(amap, m) + match TryDestStandardDelegateType infoReader m ad delTy with | Some(argTys, _) -> argTys | None -> error(nonStandardEventError einfo.EventName m) /// Get the type of the event when looked at as if it is a property /// Used when displaying the property in Intellisense -let PropTypOfEventInfo (infoReader: InfoReader) m ad (einfo: EventInfo) = +let PropTypeOfEventInfo (infoReader: InfoReader) m ad (einfo: EventInfo) = let g = infoReader.g let amap = infoReader.amap let delTy = einfo.GetDelegateType(amap, m) - let argsTy = ArgsTypOfEventInfo infoReader m ad einfo + let argsTy = ArgsTypeOfEventInfo infoReader m ad einfo mkIEventType g delTy argsTy /// Try to find the name of the metadata file for this external definition diff --git a/src/Compiler/Checking/InfoReader.fsi b/src/Compiler/Checking/InfoReader.fsi index 5941702256a..c8cec7f82da 100644 --- a/src/Compiler/Checking/InfoReader.fsi +++ b/src/Compiler/Checking/InfoReader.fsi @@ -280,7 +280,7 @@ type SigOfFunctionForDelegate = /// Given a delegate type work out the minfo, argument types, return type /// and F# function type by looking at the Invoke signature of the delegate. val GetSigOfFunctionForDelegate: - infoReader: InfoReader -> delty: TType -> m: range -> ad: AccessorDomain -> SigOfFunctionForDelegate + infoReader: InfoReader -> delTy: TType -> m: range -> ad: AccessorDomain -> SigOfFunctionForDelegate /// Try and interpret a delegate type as a "standard" .NET delegate type associated with an event, with a "sender" parameter. val TryDestStandardDelegateType: @@ -290,9 +290,9 @@ val TryDestStandardDelegateType: /// with a sender parameter. val IsStandardEventInfo: infoReader: InfoReader -> m: range -> ad: AccessorDomain -> einfo: EventInfo -> bool -val ArgsTypOfEventInfo: infoReader: InfoReader -> m: range -> ad: AccessorDomain -> einfo: EventInfo -> TType +val ArgsTypeOfEventInfo: infoReader: InfoReader -> m: range -> ad: AccessorDomain -> einfo: EventInfo -> TType -val PropTypOfEventInfo: infoReader: InfoReader -> m: range -> ad: AccessorDomain -> einfo: EventInfo -> TType +val PropTypeOfEventInfo: infoReader: InfoReader -> m: range -> ad: AccessorDomain -> einfo: EventInfo -> TType /// Try to find the name of the metadata file for this external definition val TryFindMetadataInfoOfExternalEntityRef: diff --git a/src/Compiler/Checking/MethodCalls.fs b/src/Compiler/Checking/MethodCalls.fs index 6331c9a992d..7c8c07cb883 100644 --- a/src/Compiler/Checking/MethodCalls.fs +++ b/src/Compiler/Checking/MethodCalls.fs @@ -181,7 +181,7 @@ let TryFindRelevantImplicitConversion (infoReader: InfoReader) ad reqdTy actualT let reqdTy2 = if isTyparTy g reqdTy then let tp = destTyparTy g reqdTy - match tp.Constraints |> List.choose (function TyparConstraint.CoercesTo (c, _) -> Some c | _ -> None) with + match tp.Constraints |> List.choose (function TyparConstraint.CoercesTo (tgtTy, _) -> Some tgtTy | _ -> None) with | [reqdTy2] when tp.Rigidity = TyparRigidity.Flexible -> reqdTy2 | _ -> reqdTy else reqdTy @@ -363,8 +363,8 @@ let AdjustCalledArgTypeForOptionals (infoReader: InfoReader) ad enforceNullableO calledArgTy, TypeDirectedConversionUsed.No, None | _ -> let compgenId = mkSynId range0 unassignedTyparName - let tp = mkTyparTy (Construct.NewTypar (TyparKind.Type, TyparRigidity.Flexible, SynTypar(compgenId, TyparStaticReq.None, true), false, TyparDynamicReq.No, [], false, false)) - tp, TypeDirectedConversionUsed.No, None + let tpTy = mkTyparTy (Construct.NewTypar (TyparKind.Type, TyparRigidity.Flexible, SynTypar(compgenId, TyparStaticReq.None, true), false, TyparDynamicReq.No, [], false, false)) + tpTy, TypeDirectedConversionUsed.No, None else AdjustCalledArgTypeForTypeDirectedConversionsAndAutoQuote infoReader ad callerArgTy calledArgTy calledArg m @@ -456,7 +456,7 @@ type CalledMethArgSet<'T> = let MakeCalledArgs amap m (minfo: MethInfo) minst = // Mark up the arguments with their position, so we can sort them back into order later let paramDatas = minfo.GetParamDatas(amap, m, minst) - paramDatas |> List.mapiSquared (fun i j (ParamData(isParamArrayArg, isInArg, isOutArg, optArgInfo, callerInfoFlags, nmOpt, reflArgInfo, typeOfCalledArg)) -> + paramDatas |> List.mapiSquared (fun i j (ParamData(isParamArrayArg, isInArg, isOutArg, optArgInfo, callerInfoFlags, nmOpt, reflArgInfo, calledArgTy)) -> { Position=(i,j) IsParamArray=isParamArrayArg OptArgInfo=optArgInfo @@ -465,7 +465,7 @@ let MakeCalledArgs amap m (minfo: MethInfo) minst = IsOutArg=isOutArg ReflArgInfo=reflArgInfo NameOpt=nmOpt - CalledArgumentType=typeOfCalledArg }) + CalledArgumentType=calledArgTy }) /// /// Represents the syntactic matching between a caller of a method and the called method. @@ -969,7 +969,7 @@ let BuildILMethInfoCall g amap m isProp (minfo: ILMethInfo) valUseFlags minst di /// /// QUERY: this looks overly complex considering that we are doing a fundamentally simple /// thing here. -let BuildFSharpMethodApp g m (vref: ValRef) vexp vexprty (args: Exprs) = +let BuildFSharpMethodApp g m (vref: ValRef) vExpr vexprty (args: Exprs) = let arities = (arityOfVal vref.Deref).AritiesOfArgs let args3, (leftover, retTy) = @@ -990,17 +990,17 @@ let BuildFSharpMethodApp g m (vref: ValRef) vexp vexprty (args: Exprs) = (mkRefTupled g m tupargs tuptys), (argst, rangeOfFunTy g fty) ) if not leftover.IsEmpty then error(InternalError("Unexpected "+string(leftover.Length)+" remaining arguments in method application", m)) - mkApps g ((vexp, vexprty), [], args3, m), + mkApps g ((vExpr, vexprty), [], args3, m), retTy /// Build a call to an F# method. let BuildFSharpMethodCall g m (ty, vref: ValRef) valUseFlags minst args = - let vexp = Expr.Val (vref, valUseFlags, m) - let vexpty = vref.Type + let vExpr = Expr.Val (vref, valUseFlags, m) + let vExprTy = vref.Type let tpsorig, tau = vref.GeneralizedType let vtinst = argsOfAppTy g ty @ minst if tpsorig.Length <> vtinst.Length then error(InternalError("BuildFSharpMethodCall: unexpected List.length mismatch", m)) - let expr = mkTyAppExpr m (vexp, vexpty) vtinst + let expr = mkTyAppExpr m (vExpr, vExprTy) vtinst let exprTy = instType (mkTyparInst tpsorig vtinst) tau BuildFSharpMethodApp g m vref expr exprTy args @@ -1113,8 +1113,8 @@ let BuildMethodCall tcVal g amap isMutable m isProp minfo valUseFlags minst objA if valRefEq amap.g fsValRef amap.g.reraise_vref then mkReraise m exprTy, exprTy else - let vexp, vexpty = tcVal fsValRef valUseFlags (minfo.DeclaringTypeInst @ minst) m - BuildFSharpMethodApp g m fsValRef vexp vexpty allArgs + let vExpr, vExprTy = tcVal fsValRef valUseFlags (minfo.DeclaringTypeInst @ minst) m + BuildFSharpMethodApp g m fsValRef vExpr vExprTy allArgs | None -> let ilMethRef = Import.ImportProvidedMethodBaseAsILMethodRef amap m providedMeth let isNewObj = isCtor && (match valUseFlags with NormalValUse -> true | _ -> false) @@ -1139,8 +1139,8 @@ let BuildMethodCall tcVal g amap isMutable m isProp minfo valUseFlags minst objA // Go see if this is a use of a recursive definition... Note we know the value instantiation // we want to use so we pass that in order not to create a new one. - let vexp, vexpty = tcVal vref valUseFlags (minfo.DeclaringTypeInst @ minst) m - BuildFSharpMethodApp g m vref vexp vexpty allArgs + let vExpr, vExprTy = tcVal vref valUseFlags (minfo.DeclaringTypeInst @ minst) m + BuildFSharpMethodApp g m vref vExpr vExprTy allArgs // Build a 'call' to a struct default constructor | DefaultStructCtor (g, ty) -> @@ -1793,6 +1793,7 @@ module ProvidedMethodCalls = for v, e in Seq.zip (paramVars |> Seq.map (fun x -> x.PUntaint(id, m))) (Option.toList thisArg @ allArgs) do dict.Add(v, (None, e)) dict + let rec exprToExprAndWitness top (ea: Tainted) = let fail() = error(Error(FSComp.SR.etUnsupportedProvidedExpression(ea.PUntaint((fun etree -> etree.UnderlyingExpressionString), m)), m)) match ea with @@ -1806,139 +1807,139 @@ module ProvidedMethodCalls = let srcExpr = exprToExpr expr let targetTy = Import.ImportProvidedType amap m (targetTy.PApply(id, m)) let sourceTy = Import.ImportProvidedType amap m (expr.PApply ((fun e -> e.Type), m)) - let te = mkCoerceIfNeeded g targetTy sourceTy srcExpr - None, (te, tyOfExpr g te) + let exprR = mkCoerceIfNeeded g targetTy sourceTy srcExpr + None, (exprR, tyOfExpr g exprR) | ProvidedTypeTestExpr (expr, targetTy) -> let expr, targetTy = exprType.PApply2((fun _ -> (expr, targetTy)), m) let srcExpr = exprToExpr expr let targetTy = Import.ImportProvidedType amap m (targetTy.PApply(id, m)) - let te = mkCallTypeTest g m targetTy srcExpr - None, (te, tyOfExpr g te) + let exprR = mkCallTypeTest g m targetTy srcExpr + None, (exprR, tyOfExpr g exprR) | ProvidedIfThenElseExpr (test, thenBranch, elseBranch) -> let test, thenBranch, elseBranch = exprType.PApply3((fun _ -> (test, thenBranch, elseBranch)), m) let testExpr = exprToExpr test let ifTrueExpr = exprToExpr thenBranch let ifFalseExpr = exprToExpr elseBranch - let te = mkCond DebugPointAtBinding.NoneAtSticky m (tyOfExpr g ifTrueExpr) testExpr ifTrueExpr ifFalseExpr - None, (te, tyOfExpr g te) + let exprR = mkCond DebugPointAtBinding.NoneAtSticky m (tyOfExpr g ifTrueExpr) testExpr ifTrueExpr ifFalseExpr + None, (exprR, tyOfExpr g exprR) | ProvidedVarExpr providedVar -> let _, vTe = varToExpr (exprType.PApply((fun _ -> providedVar), m)) None, (vTe, tyOfExpr g vTe) | ProvidedConstantExpr (obj, prType) -> - let ce = convertConstExpr g amap m (exprType.PApply((fun _ -> (obj, prType)), m)) - None, (ce, tyOfExpr g ce) + let exprR = convertConstExpr g amap m (exprType.PApply((fun _ -> (obj, prType)), m)) + None, (exprR, tyOfExpr g exprR) | ProvidedNewTupleExpr info -> let elems = exprType.PApplyArray((fun _ -> info), "GetInvokerExpression", m) - let elemsT = elems |> Array.map exprToExpr |> Array.toList - let exprT = mkRefTupledNoTypes g m elemsT - None, (exprT, tyOfExpr g exprT) + let elemsR = elems |> Array.map exprToExpr |> Array.toList + let exprR = mkRefTupledNoTypes g m elemsR + None, (exprR, tyOfExpr g exprR) | ProvidedNewArrayExpr (ty, elems) -> let ty, elems = exprType.PApply2((fun _ -> (ty, elems)), m) - let tyT = Import.ImportProvidedType amap m ty + let tyR = Import.ImportProvidedType amap m ty let elems = elems.PApplyArray(id, "GetInvokerExpression", m) - let elemsT = elems |> Array.map exprToExpr |> Array.toList - let exprT = Expr.Op (TOp.Array, [tyT], elemsT, m) - None, (exprT, tyOfExpr g exprT) + let elemsR = elems |> Array.map exprToExpr |> Array.toList + let exprR = Expr.Op (TOp.Array, [tyR], elemsR, m) + None, (exprR, tyOfExpr g exprR) | ProvidedTupleGetExpr (inp, n) -> let inp, n = exprType.PApply2((fun _ -> (inp, n)), m) - let inpT = inp |> exprToExpr + let inpR = inp |> exprToExpr // if type of expression is erased type then we need convert it to the underlying base type - let typeOfExpr = - let t = tyOfExpr g inpT + let exprTy = + let t = tyOfExpr g inpR stripTyEqnsWrtErasure EraseMeasures g t - let tupInfo, tysT = tryDestAnyTupleTy g typeOfExpr - let exprT = mkTupleFieldGet g (tupInfo, inpT, tysT, n.PUntaint(id, m), m) - None, (exprT, tyOfExpr g exprT) + let tupInfo, tysT = tryDestAnyTupleTy g exprTy + let exprR = mkTupleFieldGet g (tupInfo, inpR, tysT, n.PUntaint(id, m), m) + None, (exprR, tyOfExpr g exprR) | ProvidedLambdaExpr (v, b) -> let v, b = exprType.PApply2((fun _ -> (v, b)), m) - let vT = addVar v - let bT = exprToExpr b + let vR = addVar v + let bR = exprToExpr b removeVar v - let exprT = mkLambda m vT (bT, tyOfExpr g bT) - None, (exprT, tyOfExpr g exprT) + let exprR = mkLambda m vR (bR, tyOfExpr g bR) + None, (exprR, tyOfExpr g exprR) | ProvidedLetExpr (v, e, b) -> let v, e, b = exprType.PApply3((fun _ -> (v, e, b)), m) - let eT = exprToExpr e - let vT = addVar v - let bT = exprToExpr b + let eR = exprToExpr e + let vR = addVar v + let bR = exprToExpr b removeVar v - let exprT = mkCompGenLet m vT eT bT - None, (exprT, tyOfExpr g exprT) + let exprR = mkCompGenLet m vR eR bR + None, (exprR, tyOfExpr g exprR) | ProvidedVarSetExpr (v, e) -> let v, e = exprType.PApply2((fun _ -> (v, e)), m) - let eT = exprToExpr e - let vTopt, _ = varToExpr v - match vTopt with + let eR = exprToExpr e + let vOptR, _ = varToExpr v + match vOptR with | None -> fail() - | Some vT -> - let exprT = mkValSet m (mkLocalValRef vT) eT - None, (exprT, tyOfExpr g exprT) + | Some vR -> + let exprR = mkValSet m (mkLocalValRef vR) eR + None, (exprR, tyOfExpr g exprR) | ProvidedWhileLoopExpr (guardExpr, bodyExpr) -> let guardExpr, bodyExpr = (exprType.PApply2((fun _ -> (guardExpr, bodyExpr)), m)) - let guardExprT = exprToExpr guardExpr - let bodyExprT = exprToExpr bodyExpr - let exprT = mkWhile g (DebugPointAtWhile.No, SpecialWhileLoopMarker.NoSpecialWhileLoopMarker, guardExprT, bodyExprT, m) - None, (exprT, tyOfExpr g exprT) + let guardExprR = exprToExpr guardExpr + let bodyExprR = exprToExpr bodyExpr + let exprR = mkWhile g (DebugPointAtWhile.No, SpecialWhileLoopMarker.NoSpecialWhileLoopMarker, guardExprR, bodyExprR, m) + None, (exprR, tyOfExpr g exprR) | ProvidedForIntegerRangeLoopExpr (v, e1, e2, e3) -> let v, e1, e2, e3 = exprType.PApply4((fun _ -> (v, e1, e2, e3)), m) - let e1T = exprToExpr e1 - let e2T = exprToExpr e2 - let vT = addVar v - let e3T = exprToExpr e3 + let e1R = exprToExpr e1 + let e2R = exprToExpr e2 + let vR = addVar v + let e3R = exprToExpr e3 removeVar v - let exprT = mkFastForLoop g (DebugPointAtFor.No, DebugPointAtInOrTo.No, m, vT, e1T, true, e2T, e3T) - None, (exprT, tyOfExpr g exprT) + let exprR = mkFastForLoop g (DebugPointAtFor.No, DebugPointAtInOrTo.No, m, vR, e1R, true, e2R, e3R) + None, (exprR, tyOfExpr g exprR) | ProvidedNewDelegateExpr (delegateTy, boundVars, delegateBodyExpr) -> let delegateTy, boundVars, delegateBodyExpr = exprType.PApply3((fun _ -> (delegateTy, boundVars, delegateBodyExpr)), m) - let delegateTyT = Import.ImportProvidedType amap m delegateTy + let delegateTyR = Import.ImportProvidedType amap m delegateTy let vs = boundVars.PApplyArray(id, "GetInvokerExpression", m) |> Array.toList let vsT = List.map addVar vs - let delegateBodyExprT = exprToExpr delegateBodyExpr + let delegateBodyExprR = exprToExpr delegateBodyExpr List.iter removeVar vs - let lambdaExpr = mkLambdas g m [] vsT (delegateBodyExprT, tyOfExpr g delegateBodyExprT) + let lambdaExpr = mkLambdas g m [] vsT (delegateBodyExprR, tyOfExpr g delegateBodyExprR) let lambdaExprTy = tyOfExpr g lambdaExpr let infoReader = InfoReader(g, amap) - let exprT = CoerceFromFSharpFuncToDelegate g amap infoReader AccessorDomain.AccessibleFromSomewhere lambdaExprTy m lambdaExpr delegateTyT - None, (exprT, tyOfExpr g exprT) + let exprR = CoerceFromFSharpFuncToDelegate g amap infoReader AccessorDomain.AccessibleFromSomewhere lambdaExprTy m lambdaExpr delegateTyR + None, (exprR, tyOfExpr g exprR) #if PROVIDED_ADDRESS_OF | ProvidedAddressOfExpr e -> - let eT = exprToExpr (exprType.PApply((fun _ -> e), m)) - let wrap,ce, _readonly, _writeonly = mkExprAddrOfExpr g true false DefinitelyMutates eT None m - let ce = wrap ce - None, (ce, tyOfExpr g ce) + let eR = exprToExpr (exprType.PApply((fun _ -> e), m)) + let wrap,exprR, _readonly, _writeonly = mkExprAddrOfExpr g true false DefinitelyMutates eR None m + let exprR = wrap exprR + None, (exprR, tyOfExpr g exprR) #endif | ProvidedDefaultExpr pty -> let ty = Import.ImportProvidedType amap m (exprType.PApply((fun _ -> pty), m)) - let ce = mkDefault (m, ty) - None, (ce, tyOfExpr g ce) + let exprR = mkDefault (m, ty) + None, (exprR, tyOfExpr g exprR) | ProvidedCallExpr (e1, e2, e3) -> methodCallToExpr top ea (exprType.PApply((fun _ -> (e1, e2, e3)), m)) | ProvidedSequentialExpr (e1, e2) -> let e1, e2 = exprType.PApply2((fun _ -> (e1, e2)), m) - let e1T = exprToExpr e1 - let e2T = exprToExpr e2 - let ce = mkCompGenSequential m e1T e2T - None, (ce, tyOfExpr g ce) + let e1R = exprToExpr e1 + let e2R = exprToExpr e2 + let exprR = mkCompGenSequential m e1R e2R + None, (exprR, tyOfExpr g exprR) | ProvidedTryFinallyExpr (e1, e2) -> let e1, e2 = exprType.PApply2((fun _ -> (e1, e2)), m) - let e1T = exprToExpr e1 - let e2T = exprToExpr e2 - let ce = mkTryFinally g (e1T, e2T, m, tyOfExpr g e1T, DebugPointAtTry.No, DebugPointAtFinally.No) - None, (ce, tyOfExpr g ce) + let e1R = exprToExpr e1 + let e2R = exprToExpr e2 + let exprR = mkTryFinally g (e1R, e2R, m, tyOfExpr g e1R, DebugPointAtTry.No, DebugPointAtFinally.No) + None, (exprR, tyOfExpr g exprR) | ProvidedTryWithExpr (e1, e2, e3, e4, e5) -> let info = exprType.PApply((fun _ -> (e1, e2, e3, e4, e5)), m) - let bT = exprToExpr (info.PApply((fun (x, _, _, _, _) -> x), m)) + let bR = exprToExpr (info.PApply((fun (x, _, _, _, _) -> x), m)) let v1 = info.PApply((fun (_, x, _, _, _) -> x), m) - let v1T = addVar v1 - let e1T = exprToExpr (info.PApply((fun (_, _, x, _, _) -> x), m)) + let v1R = addVar v1 + let e1R = exprToExpr (info.PApply((fun (_, _, x, _, _) -> x), m)) removeVar v1 let v2 = info.PApply((fun (_, _, _, x, _) -> x), m) - let v2T = addVar v2 - let e2T = exprToExpr (info.PApply((fun (_, _, _, _, x) -> x), m)) + let v2R = addVar v2 + let e2R = exprToExpr (info.PApply((fun (_, _, _, _, x) -> x), m)) removeVar v2 - let ce = mkTryWith g (bT, v1T, e1T, v2T, e2T, m, tyOfExpr g bT, DebugPointAtTry.No, DebugPointAtWith.No) - None, (ce, tyOfExpr g ce) + let exprR = mkTryWith g (bR, v1R, e1R, v2R, e2R, m, tyOfExpr g bR, DebugPointAtTry.No, DebugPointAtWith.No) + None, (exprR, tyOfExpr g exprR) | ProvidedNewObjectExpr (e1, e2) -> None, ctorCallToExpr (exprType.PApply((fun _ -> (e1, e2)), m)) @@ -1955,10 +1956,10 @@ module ProvidedMethodCalls = let nm = v.PUntaint ((fun v -> v.Name), m) let mut = v.PUntaint ((fun v -> v.IsMutable), m) let vRaw = v.PUntaint (id, m) - let tyT = Import.ImportProvidedType amap m (v.PApply ((fun v -> v.Type), m)) - let vT, vTe = if mut then mkMutableCompGenLocal m nm tyT else mkCompGenLocal m nm tyT - varConv[vRaw] <- (Some vT, vTe) - vT + let tyR = Import.ImportProvidedType amap m (v.PApply ((fun v -> v.Type), m)) + let vR, vTe = if mut then mkMutableCompGenLocal m nm tyR else mkCompGenLocal m nm tyR + varConv[vRaw] <- (Some vR, vTe) + vR and removeVar (v: Tainted) = let vRaw = v.PUntaint (id, m) diff --git a/src/Compiler/Checking/MethodOverrides.fs b/src/Compiler/Checking/MethodOverrides.fs index 9d3e6c50153..7c5e9934a77 100644 --- a/src/Compiler/Checking/MethodOverrides.fs +++ b/src/Compiler/Checking/MethodOverrides.fs @@ -160,7 +160,7 @@ module DispatchSlotChecking = let belongsToReqdTy = match overrideBy.MemberInfo.Value.ImplementedSlotSigs with | [] -> false - | ss :: _ -> isInterfaceTy g ss.ImplementedType && typeEquiv g reqdTy ss.ImplementedType + | ss :: _ -> isInterfaceTy g ss.DeclaringType && typeEquiv g reqdTy ss.DeclaringType if belongsToReqdTy then CanImplementAnyInterfaceSlot else @@ -178,7 +178,7 @@ module DispatchSlotChecking = Override(implKind, overrideBy.MemberApparentEntity, mkSynId overrideBy.Range nm, memberMethodTypars, memberToParentInst, argTys, retTy, isFakeEventProperty, overrideBy.IsCompilerGenerated) /// Get the override information for an object expression method being used to implement dispatch slots - let GetObjectExprOverrideInfo g amap (implty, id: Ident, memberFlags, ty, arityInfo, bindingAttribs, rhsExpr) = + let GetObjectExprOverrideInfo g amap (implTy, id: Ident, memberFlags, ty, arityInfo, bindingAttribs, rhsExpr) = // Dissect the type. The '0' indicates there are no enclosing generic class type parameters relevant here. let tps, _, argInfos, retTy, _ = GetMemberTypeInMemberForm g memberFlags arityInfo 0 ty id.idRange let argTys = argInfos |> List.mapSquared fst @@ -192,13 +192,13 @@ module DispatchSlotChecking = // Check for empty variable list from a () arg let vs = if List.isSingleton vs && argInfos.IsEmpty then [] else vs let implKind = - if isInterfaceTy g implty then + if isInterfaceTy g implTy then CanImplementAnyInterfaceSlot else CanImplementAnyClassHierarchySlot //CanImplementAnySlot <<----- Change to this to enable implicit interface implementation let isFakeEventProperty = CompileAsEvent g bindingAttribs - let overrideByInfo = Override(implKind, tcrefOfAppTy g implty, id, tps, [], argTys, retTy, isFakeEventProperty, false) + let overrideByInfo = Override(implKind, tcrefOfAppTy g implTy, id, tps, [], argTys, retTy, isFakeEventProperty, false) overrideByInfo, (baseValOpt, thisv, vs, bindingAttribs, rhsExpr) | _ -> error(InternalError("Unexpected shape for object expression override", id.idRange)) @@ -749,7 +749,7 @@ module DispatchSlotChecking = let amap = infoReader.amap let tcaug = tycon.TypeContents - let interfaces = tycon.ImmediateInterfacesOfFSharpTycon |> List.map (fun (ity, _compgen, m) -> (ity, m)) + let interfaces = tycon.ImmediateInterfacesOfFSharpTycon |> List.map (fun (intfTy, _compgen, m) -> (intfTy, m)) let overallTy = generalizedTyconRef g (mkLocalTyconRef tycon) @@ -780,9 +780,9 @@ module DispatchSlotChecking = | [] -> // Are we looking at the implementation of the class hierarchy? If so include all the override members not (isInterfaceTy g reqdTy) - | ss -> - ss |> List.forall (fun ss -> - let ty = ss.ImplementedType + | slotSigs -> + slotSigs |> List.forall (fun slotSig -> + let ty = slotSig.DeclaringType if isInterfaceTy g ty then // Is this a method impl listed under the reqdTy? typeEquiv g ty reqdTy diff --git a/src/Compiler/Checking/MethodOverrides.fsi b/src/Compiler/Checking/MethodOverrides.fsi index e6091626469..b93b290f5d3 100644 --- a/src/Compiler/Checking/MethodOverrides.fsi +++ b/src/Compiler/Checking/MethodOverrides.fsi @@ -89,7 +89,7 @@ module DispatchSlotChecking = val GetObjectExprOverrideInfo: g: TcGlobals -> amap: ImportMap -> - implty: TType * + implTy: TType * id: Ident * memberFlags: SynMemberFlags * ty: TType * diff --git a/src/Compiler/Checking/NameResolution.fs b/src/Compiler/Checking/NameResolution.fs index d04f9d0929d..0f3daba1d0f 100644 --- a/src/Compiler/Checking/NameResolution.fs +++ b/src/Compiler/Checking/NameResolution.fs @@ -1420,10 +1420,10 @@ and AddModuleOrNamespaceContentsToNameEnv (g: TcGlobals) amap (ad: AccessorDomai and AddModuleOrNamespaceRefsContentsToNameEnv g amap ad m root nenv modrefs = (modrefs, nenv) ||> List.foldBack (fun modref acc -> AddModuleOrNamespaceRefContentsToNameEnv g amap ad m root acc modref) -and AddTypeContentsToNameEnv g amap ad m nenv (typ: TType) = - assert (isAppTy g typ) - assert not (tcrefOfAppTy g typ).IsModuleOrNamespace - AddStaticContentOfTypeToNameEnv g amap ad m nenv typ +and AddTypeContentsToNameEnv g amap ad m nenv (ty: TType) = + assert (isAppTy g ty) + assert not (tcrefOfAppTy g ty).IsModuleOrNamespace + AddStaticContentOfTypeToNameEnv g amap ad m nenv ty and AddModuleOrNamespaceRefContentsToNameEnv g amap ad m root nenv (modref: EntityRef) = assert modref.IsModuleOrNamespace @@ -2426,8 +2426,8 @@ let TryFindUnionCaseOfType g ty nm = ValueNone /// Try to find a union case of a type, with the given name -let TryFindAnonRecdFieldOfType g typ nm = - match tryDestAnonRecdTy g typ with +let TryFindAnonRecdFieldOfType g ty nm = + match tryDestAnonRecdTy g ty with | ValueSome (anonInfo, tys) -> match anonInfo.SortedIds |> Array.tryFindIndex (fun x -> x.idText = nm) with | Some i -> Some (Item.AnonRecdField(anonInfo, tys, i, anonInfo.SortedIds[i].idRange)) @@ -4113,7 +4113,7 @@ let rec ResolvePartialLongIdentInType (ncenv: NameResolver) nenv isApplicableMet // e.g. .. for einfo in ncenv.InfoReader.GetEventInfosOfType(Some id, ad, m, ty) do - let einfoTy = PropTypOfEventInfo ncenv.InfoReader m ad einfo + let einfoTy = PropTypeOfEventInfo ncenv.InfoReader m ad einfo yield! ResolvePartialLongIdentInType ncenv nenv isApplicableMeth m ad false rest einfoTy // nested types @@ -4811,7 +4811,7 @@ let rec ResolvePartialLongIdentInTypeForItem (ncenv: NameResolver) nenv m ad sta // e.g. .. for einfo in ncenv.InfoReader.GetEventInfosOfType(Some id, ad, m, ty) do - let tyinfo = PropTypOfEventInfo ncenv.InfoReader m ad einfo + let tyinfo = PropTypeOfEventInfo ncenv.InfoReader m ad einfo yield! ResolvePartialLongIdentInTypeForItem ncenv nenv m ad false rest item tyinfo // nested types! diff --git a/src/Compiler/Checking/NicePrint.fs b/src/Compiler/Checking/NicePrint.fs index 6d8b38c7956..a07f000c7a7 100644 --- a/src/Compiler/Checking/NicePrint.fs +++ b/src/Compiler/Checking/NicePrint.fs @@ -497,7 +497,7 @@ module PrintTypes = | _ -> itemL /// Layout a reference to a type - let layoutTyconRef denv tycon = layoutTyconRefImpl false denv tycon + let layoutTyconRef denv tcref = layoutTyconRefImpl false denv tcref /// Layout the flags of a member let layoutMemberFlags (memFlags: SynMemberFlags) = @@ -546,8 +546,8 @@ module PrintTypes = | TypeDefOfExpr denv.g ty -> LeftL.keywordTypedefof ^^ wordL (tagPunctuation "<") ^^ layoutType denv ty ^^ rightL (tagPunctuation ">") - | Expr.Op (TOp.Coerce, [tgTy;_], [arg2], _) -> - leftL (tagPunctuation "(") ^^ layoutAttribArg denv arg2 ^^ wordL (tagPunctuation ":>") ^^ layoutType denv tgTy ^^ rightL (tagPunctuation ")") + | Expr.Op (TOp.Coerce, [tgtTy;_], [arg2], _) -> + leftL (tagPunctuation "(") ^^ layoutAttribArg denv arg2 ^^ wordL (tagPunctuation ":>") ^^ layoutType denv tgtTy ^^ rightL (tagPunctuation ")") | AttribBitwiseOrExpr denv.g (arg1, arg2) -> layoutAttribArg denv arg1 ^^ wordL (tagPunctuation "|||") ^^ layoutAttribArg denv arg2 @@ -726,8 +726,8 @@ module PrintTypes = and layoutConstraintWithInfo denv env (tp, tpc) = let longConstraintPrefix l = (layoutTyparRefWithInfo denv env tp |> addColonL) ^^ l match tpc with - | TyparConstraint.CoercesTo(tpct, _) -> - [layoutTyparRefWithInfo denv env tp ^^ wordL (tagOperator ":>") --- layoutTypeWithInfo denv env tpct] + | TyparConstraint.CoercesTo(tgtTy, _) -> + [layoutTyparRefWithInfo denv env tp ^^ wordL (tagOperator ":>") --- layoutTypeWithInfo denv env tgtTy] | TyparConstraint.MayResolveMember(traitInfo, _) -> [layoutTraitWithInfo denv env traitInfo] @@ -815,8 +815,8 @@ module PrintTypes = /// Layout a unit of measure expression and layoutMeasure denv unt = - let sortVars vs = vs |> List.sortBy (fun (v: Typar, _) -> v.DisplayName) - let sortCons cs = cs |> List.sortBy (fun (c: TyconRef, _) -> c.DisplayName) + let sortVars vs = vs |> List.sortBy (fun (tp: Typar, _) -> tp.DisplayName) + let sortCons cs = cs |> List.sortBy (fun (tcref: TyconRef, _) -> tcref.DisplayName) let negvs, posvs = ListMeasureVarOccsWithNonZeroExponents unt |> sortVars |> List.partition (fun (_, e) -> SignRational e < 0) let negcs, poscs = ListMeasureConOccsWithNonZeroExponents denv.g false unt |> sortCons |> List.partition (fun (_, e) -> SignRational e < 0) let unparL uv = layoutTyparRef denv uv @@ -832,14 +832,14 @@ module PrintTypes = | _ -> prefix ^^ sepL (tagPunctuation "/") ^^ (if List.length negvs + List.length negcs > 1 then sepL (tagPunctuation "(") ^^ postfix ^^ sepL (tagPunctuation ")") else postfix) /// Layout type arguments, either NAME or (ty, ..., ty) NAME *) - and layoutTypeAppWithInfoAndPrec denv env tcL prec prefix args = + and layoutTypeAppWithInfoAndPrec denv env tcL prec prefix argTys = if prefix then - match args with + match argTys with | [] -> tcL - | [arg] -> tcL ^^ sepL (tagPunctuation "<") ^^ (layoutTypeWithInfoAndPrec denv env 4 arg) ^^ rightL (tagPunctuation">") - | args -> bracketIfL (prec <= 1) (tcL ^^ angleL (layoutTypesWithInfoAndPrec denv env 2 (sepL (tagPunctuation ",")) args)) + | [argTy] -> tcL ^^ sepL (tagPunctuation "<") ^^ (layoutTypeWithInfoAndPrec denv env 4 argTy) ^^ rightL (tagPunctuation">") + | _ -> bracketIfL (prec <= 1) (tcL ^^ angleL (layoutTypesWithInfoAndPrec denv env 2 (sepL (tagPunctuation ",")) argTys)) else - match args with + match argTys with | [] -> tcL | [arg] -> layoutTypeWithInfoAndPrec denv env 2 arg ^^ tcL | args -> bracketIfL (prec <= 1) (bracketL (layoutTypesWithInfoAndPrec denv env 2 (sepL (tagPunctuation ",")) args) --- tcL) @@ -1050,8 +1050,8 @@ module PrintTypes = prettyTyparInst, niceMethodTypars, layout - let prettyLayoutOfMemberType denv v typarInst argInfos retTy = - match PartitionValRefTypars denv.g v with + let prettyLayoutOfMemberType denv vref typarInst argInfos retTy = + match PartitionValRefTypars denv.g vref with | Some(_, _, memberMethodTypars, memberToParentInst, _) -> prettyLayoutOfMemberSigCore denv memberToParentInst (typarInst, memberMethodTypars, argInfos, retTy) | None -> @@ -1123,14 +1123,14 @@ module PrintTypes = let ty, _cxs = PrettyTypes.PrettifyType denv.g ty layoutTypeWithInfoAndPrec denv SimplifyTypes.typeSimplificationInfo0 5 ty - let layoutOfValReturnType denv (v: ValRef) = - match v.ValReprInfo with + let layoutOfValReturnType denv (vref: ValRef) = + match vref.ValReprInfo with | None -> - let tau = v.TauType + let tau = vref.TauType let _argTysl, retTy = stripFunTy denv.g tau layoutReturnType denv SimplifyTypes.typeSimplificationInfo0 retTy | Some (ValReprInfo(_typars, argInfos, _retInfo)) -> - let tau = v.TauType + let tau = vref.TauType let _c, retTy = GetTopTauTypeInFSharpForm denv.g argInfos tau Range.range0 layoutReturnType denv SimplifyTypes.typeSimplificationInfo0 retTy @@ -1147,22 +1147,22 @@ module PrintTastMemberOrVals = else nameL - let layoutMemberName (denv: DisplayEnv) (v: ValRef) niceMethodTypars tagFunction name = - let nameL = ConvertValNameToDisplayLayout v.IsBaseVal (tagFunction >> mkNav v.DefinitionRange >> wordL) name + let layoutMemberName (denv: DisplayEnv) (vref: ValRef) niceMethodTypars tagFunction name = + let nameL = ConvertValNameToDisplayLayout vref.IsBaseVal (tagFunction >> mkNav vref.DefinitionRange >> wordL) name let nameL = if denv.showMemberContainers then - layoutTyconRef denv v.MemberApparentEntity ^^ SepL.dot ^^ nameL + layoutTyconRef denv vref.MemberApparentEntity ^^ SepL.dot ^^ nameL else nameL let nameL = if denv.showTyparBinding then layoutTyparDecls denv nameL true niceMethodTypars else nameL - let nameL = layoutAccessibility denv v.Accessibility nameL + let nameL = layoutAccessibility denv vref.Accessibility nameL nameL let prettyLayoutOfMemberShortOption denv typarInst (v: Val) short = - let v = mkLocalValRef v - let membInfo = Option.get v.MemberInfo + let vref = mkLocalValRef v + let membInfo = Option.get vref.MemberInfo let stat = layoutMemberFlags membInfo.MemberFlags - let _tps, argInfos, retTy, _ = GetTypeOfMemberInFSharpForm denv.g v + let _tps, argInfos, retTy, _ = GetTypeOfMemberInFSharpForm denv.g vref if short then for argInfo in argInfos do @@ -1173,22 +1173,22 @@ module PrintTastMemberOrVals = let prettyTyparInst, memberL = match membInfo.MemberFlags.MemberKind with | SynMemberKind.Member -> - let prettyTyparInst, niceMethodTypars,tauL = prettyLayoutOfMemberType denv v typarInst argInfos retTy + let prettyTyparInst, niceMethodTypars,tauL = prettyLayoutOfMemberType denv vref typarInst argInfos retTy let resL = if short then tauL else - let nameL = layoutMemberName denv v niceMethodTypars tagMember v.DisplayNameCoreMangled - let nameL = if short then nameL else mkInlineL denv v.Deref nameL + let nameL = layoutMemberName denv vref niceMethodTypars tagMember vref.DisplayNameCoreMangled + let nameL = if short then nameL else mkInlineL denv vref.Deref nameL stat --- ((nameL |> addColonL) ^^ tauL) prettyTyparInst, resL | SynMemberKind.ClassConstructor | SynMemberKind.Constructor -> - let prettyTyparInst, _, tauL = prettyLayoutOfMemberType denv v typarInst argInfos retTy + let prettyTyparInst, _, tauL = prettyLayoutOfMemberType denv vref typarInst argInfos retTy let resL = if short then tauL else - let newL = layoutAccessibility denv v.Accessibility WordL.keywordNew + let newL = layoutAccessibility denv vref.Accessibility WordL.keywordNew stat ++ (newL |> addColonL) ^^ tauL prettyTyparInst, resL @@ -1198,8 +1198,8 @@ module PrintTastMemberOrVals = | SynMemberKind.PropertyGet -> if isNil argInfos then // use error recovery because intellisense on an incomplete file will show this - errorR(Error(FSComp.SR.tastInvalidFormForPropertyGetter(), v.Id.idRange)) - let nameL = layoutMemberName denv v [] tagProperty v.DisplayNameCoreMangled + errorR(Error(FSComp.SR.tastInvalidFormForPropertyGetter(), vref.Id.idRange)) + let nameL = layoutMemberName denv vref [] tagProperty vref.DisplayNameCoreMangled let resL = if short then nameL --- (WordL.keywordWith ^^ WordL.keywordGet) else stat --- nameL --- (WordL.keywordWith ^^ WordL.keywordGet) @@ -1209,31 +1209,31 @@ module PrintTastMemberOrVals = match argInfos with | [[(ty, _)]] when isUnitTy denv.g ty -> [] | _ -> argInfos - let prettyTyparInst, niceMethodTypars,tauL = prettyLayoutOfMemberType denv v typarInst argInfos retTy + let prettyTyparInst, niceMethodTypars,tauL = prettyLayoutOfMemberType denv vref typarInst argInfos retTy let resL = if short then if isNil argInfos then tauL else tauL --- (WordL.keywordWith ^^ WordL.keywordGet) else - let nameL = layoutMemberName denv v niceMethodTypars tagProperty v.DisplayNameCoreMangled + let nameL = layoutMemberName denv vref niceMethodTypars tagProperty vref.DisplayNameCoreMangled stat --- ((nameL |> addColonL) ^^ (if isNil argInfos then tauL else tauL --- (WordL.keywordWith ^^ WordL.keywordGet))) prettyTyparInst, resL | SynMemberKind.PropertySet -> if argInfos.Length <> 1 || isNil argInfos.Head then // use error recovery because intellisense on an incomplete file will show this - errorR(Error(FSComp.SR.tastInvalidFormForPropertySetter(), v.Id.idRange)) - let nameL = layoutMemberName denv v [] tagProperty v.DisplayNameCoreMangled + errorR(Error(FSComp.SR.tastInvalidFormForPropertySetter(), vref.Id.idRange)) + let nameL = layoutMemberName denv vref [] tagProperty vref.DisplayNameCoreMangled let resL = stat --- nameL --- (WordL.keywordWith ^^ WordL.keywordSet) emptyTyparInst, resL else let argInfos, valueInfo = List.frontAndBack argInfos.Head - let prettyTyparInst, niceMethodTypars, tauL = prettyLayoutOfMemberType denv v typarInst (if isNil argInfos then [] else [argInfos]) (fst valueInfo) + let prettyTyparInst, niceMethodTypars, tauL = prettyLayoutOfMemberType denv vref typarInst (if isNil argInfos then [] else [argInfos]) (fst valueInfo) let resL = if short then (tauL --- (WordL.keywordWith ^^ WordL.keywordSet)) else - let nameL = layoutMemberName denv v niceMethodTypars tagProperty v.DisplayNameCoreMangled + let nameL = layoutMemberName denv vref niceMethodTypars tagProperty vref.DisplayNameCoreMangled stat --- ((nameL |> addColonL) ^^ (tauL --- (WordL.keywordWith ^^ WordL.keywordSet))) prettyTyparInst, resL @@ -1730,23 +1730,23 @@ module TastDefinitionPrinting = typewordL ^^ tpsL - let sortKey (v: MethInfo) = - (not v.IsConstructor, - not v.IsInstance, // instance first - v.DisplayNameCore, // sort by name - List.sum v.NumArgs, // sort by #curried - v.NumArgs.Length) // sort by arity + let sortKey (minfo: MethInfo) = + (not minfo.IsConstructor, + not minfo.IsInstance, // instance first + minfo.DisplayNameCore, // sort by name + List.sum minfo.NumArgs, // sort by #curried + minfo.NumArgs.Length) // sort by arity - let shouldShow (valRef: ValRef option) = - match valRef with + let shouldShow (vrefOpt: ValRef option) = + match vrefOpt with | None -> true - | Some(vr) -> - (denv.showObsoleteMembers || not (CheckFSharpAttributesForObsolete denv.g vr.Attribs)) && - (denv.showHiddenMembers || not (CheckFSharpAttributesForHidden denv.g vr.Attribs)) + | Some vref -> + (denv.showObsoleteMembers || not (CheckFSharpAttributesForObsolete denv.g vref.Attribs)) && + (denv.showHiddenMembers || not (CheckFSharpAttributesForHidden denv.g vref.Attribs)) let ctors = GetIntrinsicConstructorInfosOfType infoReader m ty - |> List.filter (fun v -> IsMethInfoAccessible amap m ad v && not v.IsClassConstructor && shouldShow v.ArbitraryValRef) + |> List.filter (fun minfo -> IsMethInfoAccessible amap m ad minfo && not minfo.IsClassConstructor && shouldShow minfo.ArbitraryValRef) let iimpls = if suppressInheritanceAndInterfacesForTyInSimplifiedDisplays g amap m ty then @@ -1760,15 +1760,15 @@ module TastDefinitionPrinting = let iimplsLs = iimpls - |> List.map (fun ity -> wordL (tagKeyword (if isInterfaceTy g ty then "inherit" else "interface")) -* layoutType denv ity) + |> List.map (fun intfTy -> wordL (tagKeyword (if isInterfaceTy g ty then "inherit" else "interface")) -* layoutType denv intfTy) let props = GetImmediateIntrinsicPropInfosOfType (None, ad) g amap m ty - |> List.filter (fun v -> shouldShow v.ArbitraryValRef) + |> List.filter (fun pinfo -> shouldShow pinfo.ArbitraryValRef) let events = infoReader.GetEventInfosOfType(None, ad, m, ty) - |> List.filter (fun v -> shouldShow v.ArbitraryValRef && typeEquiv g ty v.ApparentEnclosingType) + |> List.filter (fun einfo -> shouldShow einfo.ArbitraryValRef && typeEquiv g ty einfo.ApparentEnclosingType) let impliedNames = try @@ -1883,8 +1883,8 @@ module TastDefinitionPrinting = let inherits = [ if not (suppressInheritanceAndInterfacesForTyInSimplifiedDisplays g amap m ty) then match GetSuperTypeOfType g amap m ty with - | Some super when not (isObjTy g super) && not (isValueTypeTy g super) -> - super + | Some superTy when not (isObjTy g superTy) && not (isValueTypeTy g superTy) -> + superTy | _ -> () ] @@ -2052,8 +2052,8 @@ module TastDefinitionPrinting = |> addLhs | TNoRepr when tycon.TypeAbbrev.IsSome -> - let abbreviatedType = tycon.TypeAbbrev.Value - (lhsL ^^ WordL.equals) -* (layoutType { denv with shortTypeNames = false } abbreviatedType) + let abbreviatedTy = tycon.TypeAbbrev.Value + (lhsL ^^ WordL.equals) -* (layoutType { denv with shortTypeNames = false } abbreviatedTy) | _ when isNil allDecls -> lhsL @@ -2386,8 +2386,8 @@ module PrintData = else layoutConst denv.g ty c - | Expr.Val (v, _, _) -> - wordL (tagLocal v.DisplayName) + | Expr.Val (vref, _, _) -> + wordL (tagLocal vref.DisplayName) | Expr.Link rX -> dataExprWrapL denv isAtomic rX.Value @@ -2435,21 +2435,28 @@ let outputValOrMember denv infoReader os x = x |> PrintTastMemberOrVals.prettyLa let stringValOrMember denv infoReader x = x |> PrintTastMemberOrVals.prettyLayoutOfValOrMemberNoInst denv infoReader |> showL /// Print members with a qualification showing the type they are contained in -let layoutQualifiedValOrMember denv infoReader typarInst v = PrintTastMemberOrVals.prettyLayoutOfValOrMember { denv with showMemberContainers=true; } infoReader typarInst v +let layoutQualifiedValOrMember denv infoReader typarInst vref = + PrintTastMemberOrVals.prettyLayoutOfValOrMember { denv with showMemberContainers=true; } infoReader typarInst vref -let outputQualifiedValOrMember denv infoReader os v = outputValOrMember { denv with showMemberContainers=true; } infoReader os v +let outputQualifiedValOrMember denv infoReader os vref = + outputValOrMember { denv with showMemberContainers=true; } infoReader os vref -let outputQualifiedValSpec denv infoReader os v = outputQualifiedValOrMember denv infoReader os v +let outputQualifiedValSpec denv infoReader os vref = + outputQualifiedValOrMember denv infoReader os vref -let stringOfQualifiedValOrMember denv infoReader v = PrintTastMemberOrVals.prettyLayoutOfValOrMemberNoInst { denv with showMemberContainers=true; } infoReader v |> showL +let stringOfQualifiedValOrMember denv infoReader vref = + PrintTastMemberOrVals.prettyLayoutOfValOrMemberNoInst { denv with showMemberContainers=true; } infoReader vref |> showL /// Convert a MethInfo to a string -let formatMethInfoToBufferFreeStyle infoReader m denv buf d = InfoMemberPrinting.formatMethInfoToBufferFreeStyle infoReader m denv buf d +let formatMethInfoToBufferFreeStyle infoReader m denv buf d = + InfoMemberPrinting.formatMethInfoToBufferFreeStyle infoReader m denv buf d -let prettyLayoutOfMethInfoFreeStyle infoReader m denv typarInst minfo = InfoMemberPrinting.prettyLayoutOfMethInfoFreeStyle infoReader m denv typarInst minfo +let prettyLayoutOfMethInfoFreeStyle infoReader m denv typarInst minfo = + InfoMemberPrinting.prettyLayoutOfMethInfoFreeStyle infoReader m denv typarInst minfo /// Convert a PropInfo to a string -let prettyLayoutOfPropInfoFreeStyle g amap m denv d = InfoMemberPrinting.prettyLayoutOfPropInfoFreeStyle g amap m denv d +let prettyLayoutOfPropInfoFreeStyle g amap m denv d = + InfoMemberPrinting.prettyLayoutOfPropInfoFreeStyle g amap m denv d /// Convert a MethInfo to a string let stringOfMethInfo infoReader m denv minfo = @@ -2509,13 +2516,15 @@ let stringOfILAttrib denv x = x |> PrintTypes.layoutILAttrib denv |> squareAngle let layoutImpliedSignatureOfModuleOrNamespace showHeader denv infoReader ad m contents = InferredSigPrinting.layoutImpliedSignatureOfModuleOrNamespace showHeader denv infoReader ad m contents -let prettyLayoutOfValOrMember denv infoReader typarInst v = PrintTastMemberOrVals.prettyLayoutOfValOrMember denv infoReader typarInst v +let prettyLayoutOfValOrMember denv infoReader typarInst vref = + PrintTastMemberOrVals.prettyLayoutOfValOrMember denv infoReader typarInst vref -let prettyLayoutOfValOrMemberNoInst denv infoReader v = PrintTastMemberOrVals.prettyLayoutOfValOrMemberNoInst denv infoReader v +let prettyLayoutOfValOrMemberNoInst denv infoReader vref = + PrintTastMemberOrVals.prettyLayoutOfValOrMemberNoInst denv infoReader vref let prettyLayoutOfMemberNoInstShort denv v = PrintTastMemberOrVals.prettyLayoutOfMemberNoInstShort denv v -let layoutOfValReturnType denv v = v |> PrintTypes.layoutOfValReturnType denv +let layoutOfValReturnType denv vref = vref |> PrintTypes.layoutOfValReturnType denv let prettyLayoutOfInstAndSig denv x = PrintTypes.prettyLayoutOfInstAndSig denv x @@ -2523,14 +2532,14 @@ let prettyLayoutOfInstAndSig denv x = PrintTypes.prettyLayoutOfInstAndSig denv x /// /// If the output text is different without showing constraints and/or imperative type variable /// annotations and/or fully qualifying paths then don't show them! -let minimalStringsOfTwoTypes denv t1 t2= - let (t1, t2), tpcs = PrettyTypes.PrettifyTypePair denv.g (t1, t2) +let minimalStringsOfTwoTypes denv ty1 ty2 = + let (ty1, ty2), tpcs = PrettyTypes.PrettifyTypePair denv.g (ty1, ty2) // try denv + no type annotations let attempt1 = let denv = { denv with showInferenceTyparAnnotations=false; showStaticallyResolvedTyparAnnotations=false } - let min1 = stringOfTy denv t1 - let min2 = stringOfTy denv t2 + let min1 = stringOfTy denv ty1 + let min2 = stringOfTy denv ty2 if min1 <> min2 then Some (min1, min2, "") else None match attempt1 with @@ -2540,8 +2549,8 @@ let minimalStringsOfTwoTypes denv t1 t2= // try denv + no type annotations + show full paths let attempt2 = let denv = { denv with showInferenceTyparAnnotations=false; showStaticallyResolvedTyparAnnotations=false }.SetOpenPaths [] - let min1 = stringOfTy denv t1 - let min2 = stringOfTy denv t2 + let min1 = stringOfTy denv ty1 + let min2 = stringOfTy denv ty2 if min1 <> min2 then Some (min1, min2, "") else None match attempt2 with @@ -2549,8 +2558,8 @@ let minimalStringsOfTwoTypes denv t1 t2= | None -> let attempt3 = - let min1 = stringOfTy denv t1 - let min2 = stringOfTy denv t2 + let min1 = stringOfTy denv ty1 + let min2 = stringOfTy denv ty2 if min1 <> min2 then Some (min1, min2, stringOfTyparConstraints denv tpcs) else None match attempt3 with @@ -2561,8 +2570,8 @@ let minimalStringsOfTwoTypes denv t1 t2= // try denv + show full paths + static parameters let denv = denv.SetOpenPaths [] let denv = { denv with includeStaticParametersInTypeNames=true } - let min1 = stringOfTy denv t1 - let min2 = stringOfTy denv t2 + let min1 = stringOfTy denv ty1 + let min2 = stringOfTy denv ty2 if min1 <> min2 then Some (min1, min2, stringOfTyparConstraints denv tpcs) else None match attempt4 with @@ -2576,19 +2585,19 @@ let minimalStringsOfTwoTypes denv t1 t2= let assemblyName = PrintTypes.layoutAssemblyName denv t |> function | null | "" -> "" | name -> sprintf " (%s)" name sprintf "%s%s" (stringOfTy denv t) assemblyName - (makeName t1, makeName t2, stringOfTyparConstraints denv tpcs) + (makeName ty1, makeName ty2, stringOfTyparConstraints denv tpcs) // Note: Always show imperative annotations when comparing value signatures -let minimalStringsOfTwoValues denv infoReader v1 v2= +let minimalStringsOfTwoValues denv infoReader vref1 vref2 = let denvMin = { denv with showInferenceTyparAnnotations=true; showStaticallyResolvedTyparAnnotations=false } - let min1 = buildString (fun buf -> outputQualifiedValOrMember denvMin infoReader buf v1) - let min2 = buildString (fun buf -> outputQualifiedValOrMember denvMin infoReader buf v2) + let min1 = buildString (fun buf -> outputQualifiedValOrMember denvMin infoReader buf vref1) + let min2 = buildString (fun buf -> outputQualifiedValOrMember denvMin infoReader buf vref2) if min1 <> min2 then (min1, min2) else let denvMax = { denv with showInferenceTyparAnnotations=true; showStaticallyResolvedTyparAnnotations=true } - let max1 = buildString (fun buf -> outputQualifiedValOrMember denvMax infoReader buf v1) - let max2 = buildString (fun buf -> outputQualifiedValOrMember denvMax infoReader buf v2) + let max1 = buildString (fun buf -> outputQualifiedValOrMember denvMax infoReader buf vref1) + let max2 = buildString (fun buf -> outputQualifiedValOrMember denvMax infoReader buf vref2) max1, max2 let minimalStringOfType denv ty = diff --git a/src/Compiler/Checking/NicePrint.fsi b/src/Compiler/Checking/NicePrint.fsi index c9df76a87a7..523202af9b9 100644 --- a/src/Compiler/Checking/NicePrint.fsi +++ b/src/Compiler/Checking/NicePrint.fsi @@ -54,14 +54,14 @@ val layoutQualifiedValOrMember: denv: DisplayEnv -> infoReader: InfoReader -> typarInst: TyparInstantiation -> - v: ValRef -> + vref: ValRef -> TyparInstantiation * Layout -val outputQualifiedValOrMember: denv: DisplayEnv -> infoReader: InfoReader -> os: StringBuilder -> v: ValRef -> unit +val outputQualifiedValOrMember: denv: DisplayEnv -> infoReader: InfoReader -> os: StringBuilder -> vref: ValRef -> unit -val outputQualifiedValSpec: denv: DisplayEnv -> infoReader: InfoReader -> os: StringBuilder -> v: ValRef -> unit +val outputQualifiedValSpec: denv: DisplayEnv -> infoReader: InfoReader -> os: StringBuilder -> vref: ValRef -> unit -val stringOfQualifiedValOrMember: denv: DisplayEnv -> infoReader: InfoReader -> v: ValRef -> string +val stringOfQualifiedValOrMember: denv: DisplayEnv -> infoReader: InfoReader -> vref: ValRef -> string val formatMethInfoToBufferFreeStyle: infoReader: InfoReader -> m: range -> denv: DisplayEnv -> buf: StringBuilder -> d: MethInfo -> unit @@ -139,22 +139,23 @@ val prettyLayoutOfValOrMember: denv: DisplayEnv -> infoReader: InfoReader -> typarInst: TyparInstantiation -> - v: ValRef -> + vref: ValRef -> TyparInstantiation * Layout -val prettyLayoutOfValOrMemberNoInst: denv: DisplayEnv -> infoReader: InfoReader -> v: ValRef -> Layout +val prettyLayoutOfValOrMemberNoInst: denv: DisplayEnv -> infoReader: InfoReader -> vref: ValRef -> Layout val prettyLayoutOfMemberNoInstShort: denv: DisplayEnv -> v: Val -> Layout -val layoutOfValReturnType: denv: DisplayEnv -> v: ValRef -> Layout +val layoutOfValReturnType: denv: DisplayEnv -> vref: ValRef -> Layout val prettyLayoutOfInstAndSig: denv: DisplayEnv -> TyparInstantiation * TTypes * TType -> TyparInstantiation * (TTypes * TType) * (Layout list * Layout) * Layout -val minimalStringsOfTwoTypes: denv: DisplayEnv -> t1: TType -> t2: TType -> string * string * string +val minimalStringsOfTwoTypes: denv: DisplayEnv -> ty1: TType -> ty2: TType -> string * string * string -val minimalStringsOfTwoValues: denv: DisplayEnv -> infoReader: InfoReader -> v1: ValRef -> v2: ValRef -> string * string +val minimalStringsOfTwoValues: + denv: DisplayEnv -> infoReader: InfoReader -> vref1: ValRef -> vref2: ValRef -> string * string val minimalStringOfType: denv: DisplayEnv -> ty: TType -> string diff --git a/src/Compiler/Checking/PatternMatchCompilation.fs b/src/Compiler/Checking/PatternMatchCompilation.fs index c38f65e307e..ec5c5488f81 100644 --- a/src/Compiler/Checking/PatternMatchCompilation.fs +++ b/src/Compiler/Checking/PatternMatchCompilation.fs @@ -312,8 +312,8 @@ let RefuteDiscrimSet g m path discrims = raise CannotRefute go path tm -let rec CombineRefutations g r1 r2 = - match r1, r2 with +let rec CombineRefutations g refutation1 refutation2 = + match refutation1, refutation2 with | Expr.Val (vref, _, _), other | other, Expr.Val (vref, _, _) when vref.LogicalName = "_" -> other | Expr.Val (vref, _, _), other | other, Expr.Val (vref, _, _) when vref.LogicalName = notNullText -> other | Expr.Val (vref, _, _), other | other, Expr.Val (vref, _, _) when vref.LogicalName = otherSubtypeText -> other @@ -326,9 +326,9 @@ let rec CombineRefutations g r1 r2 = Expr.Op (op1, tinst1, List.map2 (CombineRefutations g) flds1 flds2, m1) (* Choose the greater of the two ucrefs based on name ordering *) elif ucref1.CaseName < ucref2.CaseName then - r2 + refutation2 else - r1 + refutation1 | Expr.Op (op1, tinst1, flds1, m1), Expr.Op (_, _, flds2, _) -> Expr.Op (op1, tinst1, List.map2 (CombineRefutations g) flds1 flds2, m1) @@ -352,7 +352,7 @@ let rec CombineRefutations g r1 r2 = Expr.Const (c12, m1, ty1) - | _ -> r1 + | _ -> refutation1 let ShowCounterExample g denv m refuted = try @@ -592,8 +592,8 @@ let getDiscrimOfPattern (g: TcGlobals) tpinst t = match t with | TPat_null _m -> Some(DecisionTreeTest.IsNull) - | TPat_isinst (srcty, tgty, _, _m) -> - Some(DecisionTreeTest.IsInst (instType tpinst srcty, instType tpinst tgty)) + | TPat_isinst (srcTy, tgtTy, _, _m) -> + Some(DecisionTreeTest.IsInst (instType tpinst srcTy, instType tpinst tgtTy)) | TPat_exnconstr(tcref, _, _m) -> Some(DecisionTreeTest.IsInst (g.exn_ty, mkAppTy tcref [])) | TPat_const (c, _m) -> @@ -624,7 +624,7 @@ let discrimsEq (g: TcGlobals) d1 d2 = | DecisionTreeTest.ArrayLength (n1, _), DecisionTreeTest.ArrayLength(n2, _) -> (n1=n2) | DecisionTreeTest.Const c1, DecisionTreeTest.Const c2 -> (c1=c2) | DecisionTreeTest.IsNull, DecisionTreeTest.IsNull -> true - | DecisionTreeTest.IsInst (srcty1, tgty1), DecisionTreeTest.IsInst (srcty2, tgty2) -> typeEquiv g srcty1 srcty2 && typeEquiv g tgty1 tgty2 + | DecisionTreeTest.IsInst (srcTy1, tgtTy1), DecisionTreeTest.IsInst (srcTy2, tgtTy2) -> typeEquiv g srcTy1 srcTy2 && typeEquiv g tgtTy1 tgtTy2 | DecisionTreeTest.ActivePatternCase (_, _, _, vrefOpt1, n1, _), DecisionTreeTest.ActivePatternCase (_, _, _, vrefOpt2, n2, _) -> match vrefOpt1, vrefOpt2 with | Some (vref1, tinst1), Some (vref2, tinst2) -> valRefEq g vref1 vref2 && n1 = n2 && not (doesActivePatternHaveFreeTypars g vref1) && List.lengthsEqAndForall2 (typeEquiv g) tinst1 tinst2 @@ -1213,15 +1213,15 @@ let CompilePatternBasic // This is really an optimization that could be done more effectively in opt.fs // if we flowed a bit of information through - | [EdgeDiscrim(_i', DecisionTreeTest.IsInst (_srcty, tgty), m)] + | [EdgeDiscrim(_i', DecisionTreeTest.IsInst (_srcTy, tgtTy), m)] // check we can use a simple 'isinst' instruction - when isRefTy g tgty && canUseTypeTestFast g tgty && isNil origInputValTypars -> + when isRefTy g tgtTy && canUseTypeTestFast g tgtTy && isNil origInputValTypars -> - let v, vExpr = mkCompGenLocal m "typeTestResult" tgty + let v, vExpr = mkCompGenLocal m "typeTestResult" tgtTy if origInputVal.IsMemberOrModuleBinding then AdjustValToTopVal v origInputVal.DeclaringEntity ValReprInfo.emptyValData let argExpr = GetSubExprOfInput subexpr - let appExpr = mkIsInst tgty argExpr mMatch + let appExpr = mkIsInst tgtTy argExpr mMatch Some vExpr, Some(mkInvisibleBind v appExpr) // Any match on a struct union must take the address of its input. diff --git a/src/Compiler/Checking/PostInferenceChecks.fs b/src/Compiler/Checking/PostInferenceChecks.fs index 1459fc99984..d8bca9c223c 100644 --- a/src/Compiler/Checking/PostInferenceChecks.fs +++ b/src/Compiler/Checking/PostInferenceChecks.fs @@ -416,8 +416,8 @@ and CheckTypeConstraintDeep cenv f g env x = | TyparConstraint.MayResolveMember(traitInfo, _) -> CheckTraitInfoDeep cenv f g env traitInfo | TyparConstraint.DefaultsTo(_, ty, _) -> CheckTypeDeep cenv f g env true ty | TyparConstraint.SimpleChoice(tys, _) -> CheckTypesDeep cenv f g env tys - | TyparConstraint.IsEnum(uty, _) -> CheckTypeDeep cenv f g env true uty - | TyparConstraint.IsDelegate(aty, bty, _) -> CheckTypeDeep cenv f g env true aty; CheckTypeDeep cenv f g env true bty + | TyparConstraint.IsEnum(underlyingTy, _) -> CheckTypeDeep cenv f g env true underlyingTy + | TyparConstraint.IsDelegate(argTys, retTy, _) -> CheckTypeDeep cenv f g env true argTys; CheckTypeDeep cenv f g env true retTy | TyparConstraint.SupportsComparison _ | TyparConstraint.SupportsEquality _ | TyparConstraint.SupportsNull _ @@ -717,39 +717,42 @@ type TTypeEquality = | FeasiblyEqual | NotEqual -let compareTypesWithRegardToTypeVariablesAndMeasures g amap m typ1 typ2 = +let compareTypesWithRegardToTypeVariablesAndMeasures g amap m ty1 ty2 = - if (typeEquiv g typ1 typ2) then + if (typeEquiv g ty1 ty2) then ExactlyEqual else - if (typeEquiv g typ1 typ2 || TypesFeasiblyEquivStripMeasures g amap m typ1 typ2) then + if (typeEquiv g ty1 ty2 || TypesFeasiblyEquivStripMeasures g amap m ty1 ty2) then FeasiblyEqual else NotEqual -let CheckMultipleInterfaceInstantiations cenv (typ:TType) (interfaces:TType list) isObjectExpression m = - let keyf ty = assert isAppTy cenv.g ty; (tcrefOfAppTy cenv.g ty).Stamp - let groups = interfaces |> List.groupBy keyf +let keyTyByStamp g ty = + assert isAppTy g ty + (tcrefOfAppTy g ty).Stamp + +let CheckMultipleInterfaceInstantiations cenv (ty:TType) (interfaces:TType list) isObjectExpression m = + let groups = interfaces |> List.groupBy (keyTyByStamp cenv.g) let errors = seq { for _, items in groups do for i1 in 0 .. items.Length - 1 do for i2 in i1 + 1 .. items.Length - 1 do - let typ1 = items[i1] - let typ2 = items[i2] - let tcRef1 = tcrefOfAppTy cenv.g typ1 - match compareTypesWithRegardToTypeVariablesAndMeasures cenv.g cenv.amap m typ1 typ2 with + let ty1 = items[i1] + let ty2 = items[i2] + let tcRef1 = tcrefOfAppTy cenv.g ty1 + match compareTypesWithRegardToTypeVariablesAndMeasures cenv.g cenv.amap m ty1 ty2 with | ExactlyEqual -> () | FeasiblyEqual -> match tryLanguageFeatureErrorOption cenv.g.langVersion LanguageFeature.InterfacesWithMultipleGenericInstantiation m with | None -> () | Some exn -> exn - let typ1Str = NicePrint.minimalStringOfType cenv.denv typ1 - let typ2Str = NicePrint.minimalStringOfType cenv.denv typ2 + let typ1Str = NicePrint.minimalStringOfType cenv.denv ty1 + let typ2Str = NicePrint.minimalStringOfType cenv.denv ty2 if isObjectExpression then Error(FSComp.SR.typrelInterfaceWithConcreteAndVariableObjectExpression(tcRef1.DisplayNameWithStaticParametersAndUnderscoreTypars, typ1Str, typ2Str),m) else - let typStr = NicePrint.minimalStringOfType cenv.denv typ + let typStr = NicePrint.minimalStringOfType cenv.denv ty Error(FSComp.SR.typrelInterfaceWithConcreteAndVariable(typStr, tcRef1.DisplayNameWithStaticParametersAndUnderscoreTypars, typ1Str, typ2Str),m) | NotEqual -> @@ -1575,8 +1578,8 @@ and CheckExprOp cenv env (op, tyargs, args, m) ctxt expr = errorR(Error(FSComp.SR.chkNoWriteToLimitedSpan(rf.FieldName), m)) NoLimit - | TOp.Coerce, [tgty;srcty], [x] -> - if TypeDefinitelySubsumesTypeNoCoercion 0 g cenv.amap m tgty srcty then + | TOp.Coerce, [tgtTy;srcTy], [x] -> + if TypeDefinitelySubsumesTypeNoCoercion 0 g cenv.amap m tgtTy srcTy then CheckExpr cenv env x ctxt else CheckTypeInstNoByrefs cenv env m tyargs @@ -2279,8 +2282,8 @@ let CheckEntityDefn cenv env (tycon: Entity) = let allVirtualMethsInParent = match GetSuperTypeOfType g cenv.amap m ty with - | Some super -> - GetIntrinsicMethInfosOfType cenv.infoReader None AccessibleFromSomewhere AllowMultiIntfInstantiations.Yes IgnoreOverrides m super + | Some superTy -> + GetIntrinsicMethInfosOfType cenv.infoReader None AccessibleFromSomewhere AllowMultiIntfInstantiations.Yes IgnoreOverrides m superTy |> List.filter (fun minfo -> minfo.IsVirtual) | None -> [] diff --git a/src/Compiler/Checking/QuotationTranslator.fs b/src/Compiler/Checking/QuotationTranslator.fs index 044ff283f0b..089de7b4a7f 100644 --- a/src/Compiler/Checking/QuotationTranslator.fs +++ b/src/Compiler/Checking/QuotationTranslator.fs @@ -172,7 +172,7 @@ let (|ModuleValueOrMemberUse|_|) g expr = match stripExpr expr with | Expr.App (InnerExprPat(Expr.Val (vref, vFlags, _) as f), fty, tyargs, actualArgs, _m) when vref.IsMemberOrModuleBinding -> Some(vref, vFlags, f, fty, tyargs, actualArgs @ args) - | Expr.App (f, _fty, [], actualArgs, _) -> + | Expr.App (f, _fTy, [], actualArgs, _) -> loop f (actualArgs @ args) | Expr.Val (vref, vFlags, _m) as f when (match vref.DeclaringEntity with ParentNone -> false | _ -> true) -> let fty = tyOfExpr g f @@ -292,8 +292,8 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP. // Recognize applications of module functions. match expr with // Detect expression tree exprSplices - | Expr.App (InnerExprPat(Expr.Val (vf, _, _)), _, _, x0 :: rest, m) - when isSplice g vf -> + | Expr.App (InnerExprPat(Expr.Val (vref, _, _)), _, _, x0 :: rest, m) + when isSplice g vref -> let idx = cenv.exprSplices.Count let ty = tyOfExpr g expr @@ -305,7 +305,7 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP. let hole = QP.mkHole(ConvType cenv env m ty, idx) (hole, rest) ||> List.fold (fun fR arg -> QP.mkApp (fR, ConvExpr cenv env arg)) - | ModuleValueOrMemberUse g (vref, vFlags, _f, _fty, tyargs, curriedArgs) + | ModuleValueOrMemberUse g (vref, vFlags, _f, _fTy, tyargs, curriedArgs) when not (isSplice g vref) -> let m = expr.Range @@ -419,16 +419,16 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP. List.fold (fun fR arg -> QP.mkApp (fR, ConvExpr cenv env arg)) callR laterArgs // Blast type application nodes and expression application nodes apart so values are left with just their type arguments - | Expr.App (f, fty, (_ :: _ as tyargs), (_ :: _ as args), m) -> - let rfty = applyForallTy g fty tyargs - ConvExpr cenv env (primMkApp (primMkApp (f, fty) tyargs [] m, rfty) [] args m) + | Expr.App (f, fTy, (_ :: _ as tyargs), (_ :: _ as args), m) -> + let reducedTy = applyForallTy g fTy tyargs + ConvExpr cenv env (primMkApp (primMkApp (f, fTy) tyargs [] m, reducedTy) [] args m) // Uses of possibly-polymorphic values - | Expr.App (InnerExprPat(Expr.Val (vref, _vFlags, m)), _fty, tyargs, [], _) -> + | Expr.App (InnerExprPat(Expr.Val (vref, _vFlags, m)), _fTy, tyargs, [], _) -> ConvValRef true cenv env m vref tyargs // Simple applications - | Expr.App (f, _fty, tyargs, args, m) -> + | Expr.App (f, _fTy, tyargs, args, m) -> if not (List.isEmpty tyargs) then wfail(Error(FSComp.SR.crefQuotationsCantContainGenericExprs(), m)) List.fold (fun fR arg -> QP.mkApp (fR, ConvExpr cenv env arg)) (ConvExpr cenv env f) args @@ -828,12 +828,12 @@ and ConvLValueExprCore cenv env expr = | TOp.UnionCaseFieldGetAddr (ucref, n, _), [e], _ -> ConvUnionFieldGet cenv env m ucref n tyargs e | TOp.ILAsm ([ I_ldflda(fspec) ], _), _, _ -> ConvLdfld cenv env m fspec tyargs args | TOp.ILAsm ([ I_ldsflda(fspec) ], _), _, _ -> ConvLdfld cenv env m fspec tyargs args - | TOp.ILAsm ([ I_ldelema(_ro, _isNativePtr, shape, _tyarg) ], _), arr :: idxs, [elemty] -> + | TOp.ILAsm ([ I_ldelema(_ro, _isNativePtr, shape, _tyarg) ], _), arr :: idxs, [elemTy] -> match shape.Rank, idxs with - | 1, [idx1] -> ConvExpr cenv env (mkCallArrayGet cenv.g m elemty arr idx1) - | 2, [idx1; idx2] -> ConvExpr cenv env (mkCallArray2DGet cenv.g m elemty arr idx1 idx2) - | 3, [idx1; idx2; idx3] -> ConvExpr cenv env (mkCallArray3DGet cenv.g m elemty arr idx1 idx2 idx3) - | 4, [idx1; idx2; idx3; idx4] -> ConvExpr cenv env (mkCallArray4DGet cenv.g m elemty arr idx1 idx2 idx3 idx4) + | 1, [idx1] -> ConvExpr cenv env (mkCallArrayGet cenv.g m elemTy arr idx1) + | 2, [idx1; idx2] -> ConvExpr cenv env (mkCallArray2DGet cenv.g m elemTy arr idx1 idx2) + | 3, [idx1; idx2; idx3] -> ConvExpr cenv env (mkCallArray3DGet cenv.g m elemTy arr idx1 idx2 idx3) + | 4, [idx1; idx2; idx3; idx4] -> ConvExpr cenv env (mkCallArray4DGet cenv.g m elemTy arr idx1 idx2 idx3 idx4) | _ -> ConvExpr cenv env expr | _ -> ConvExpr cenv env expr | _ -> ConvExpr cenv env expr @@ -937,15 +937,15 @@ and private ConvValRefCore holeOk cenv env m (vref: ValRef) tyargs = elif v.IsCtorThisVal && cenv.isReflectedDefinition = IsReflectedDefinition.Yes then QP.mkThisVar(ConvType cenv env m v.Type) else - let vty = v.Type + let vTy = v.Type match v.DeclaringEntity with | ParentNone -> // References to local values are embedded by value if not holeOk then wfail(Error(FSComp.SR.crefNoSetOfHole(), m)) let idx = cenv.exprSplices.Count - let liftExpr = mkCallLiftValueWithName cenv.g m vty v.LogicalName (exprForValRef m vref) + let liftExpr = mkCallLiftValueWithName cenv.g m vTy v.LogicalName (exprForValRef m vref) cenv.exprSplices.Add((liftExpr, m)) - QP.mkHole(ConvType cenv env m vty, idx) + QP.mkHole(ConvType cenv env m vTy, idx) | Parent _ -> // First-class use or use of type function @@ -1106,9 +1106,9 @@ and ConvDecisionTree cenv env tgs typR x = let eqR = ConvExpr cenv env eq QP.mkCond (eqR, ConvDecisionTree cenv env tgs typR dtree, acc) - | DecisionTreeTest.IsInst (_srcty, tgty) -> + | DecisionTreeTest.IsInst (_srcTy, tgtTy) -> let e1R = ConvExpr cenv env e1 - QP.mkCond (QP.mkTypeTest (ConvType cenv env m tgty, e1R), ConvDecisionTree cenv env tgs typR dtree, acc) + QP.mkCond (QP.mkTypeTest (ConvType cenv env m tgtTy, e1R), ConvDecisionTree cenv env tgs typR dtree, acc) | DecisionTreeTest.ActivePatternCase _ -> wfail(InternalError( "DecisionTreeTest.ActivePatternCase test in quoted expression", m)) diff --git a/src/Compiler/Checking/SignatureConformance.fs b/src/Compiler/Checking/SignatureConformance.fs index f9d9b41b871..4a689f48a0c 100644 --- a/src/Compiler/Checking/SignatureConformance.fs +++ b/src/Compiler/Checking/SignatureConformance.fs @@ -187,26 +187,26 @@ type Checker(g, amap, denv, remapInfo: SignatureRepackageInfo, checkingSig) = else let aenv = aenv.BindEquivTypars implTypars sigTypars - let aintfs = implTycon.ImmediateInterfaceTypesOfFSharpTycon - let fintfs = sigTycon.ImmediateInterfaceTypesOfFSharpTycon - let aintfsUser = implTycon.TypeContents.tcaug_interfaces |> List.filter (fun (_, compgen, _) -> not compgen) |> List.map p13 + let implIntfTys = implTycon.ImmediateInterfaceTypesOfFSharpTycon + let sigIntfTys = sigTycon.ImmediateInterfaceTypesOfFSharpTycon + let implUserIntfTys = implTycon.TypeContents.tcaug_interfaces |> List.filter (fun (_, compgen, _) -> not compgen) |> List.map p13 let flatten tys = tys |> List.collect (AllSuperTypesOfType g amap m AllowMultiIntfInstantiations.Yes) |> ListSet.setify (typeEquiv g) |> List.filter (isInterfaceTy g) - let aintfs = flatten aintfs - let fintfs = flatten fintfs + let implIntfTys = flatten implIntfTys + let sigIntfTys = flatten sigIntfTys - let unimpl = ListSet.subtract (fun fity aity -> typeAEquiv g aenv aity fity) fintfs aintfs - (unimpl + let unimplIntfTys = ListSet.subtract (fun sigIntfTy implIntfTy -> typeAEquiv g aenv implIntfTy sigIntfTy) sigIntfTys implIntfTys + (unimplIntfTys |> List.forall (fun ity -> let errorMessage = FSComp.SR.DefinitionsInSigAndImplNotCompatibleMissingInterface(implTycon.TypeOrMeasureKind.ToString(), implTycon.DisplayName, NicePrint.minimalStringOfType denv ity) errorR (Error(errorMessage, m)); false)) && - let aintfsUser = flatten aintfsUser + let implUserIntfTys = flatten implUserIntfTys - let hidden = ListSet.subtract (typeAEquiv g aenv) aintfsUser fintfs + let hidden = ListSet.subtract (typeAEquiv g aenv) implUserIntfTys sigIntfTys let continueChecks, warningOrError = if implTycon.IsFSharpInterfaceTycon then false, errorR else true, warning (hidden |> List.forall (fun ity -> warningOrError (InterfaceNotRevealed(denv, ity, implTycon.Range)); continueChecks)) && @@ -328,12 +328,12 @@ type Checker(g, amap, denv, remapInfo: SignatureRepackageInfo, checkingSig) = elif implVal.LiteralValue <> sigVal.LiteralValue then (err denv FSComp.SR.ValueNotContainedMutabilityLiteralConstantValuesDiffer) elif implVal.IsTypeFunction <> sigVal.IsTypeFunction then (err denv FSComp.SR.ValueNotContainedMutabilityOneIsTypeFunction) else - let implTypars, atau = implVal.GeneralizedType - let sigTypars, ftau = sigVal.GeneralizedType + let implTypars, implValTy = implVal.GeneralizedType + let sigTypars, sigValTy = sigVal.GeneralizedType if implTypars.Length <> sigTypars.Length then (err {denv with showTyparBinding=true} FSComp.SR.ValueNotContainedMutabilityParameterCountsDiffer) else let aenv = aenv.BindEquivTypars implTypars sigTypars checkTypars m aenv implTypars sigTypars && - if not (typeAEquiv g aenv atau ftau) then err denv FSComp.SR.ValueNotContainedMutabilityTypesDiffer + if not (typeAEquiv g aenv implValTy sigValTy) then err denv FSComp.SR.ValueNotContainedMutabilityTypesDiffer elif not (checkValInfo aenv (err denv) implVal sigVal) then false elif not (implVal.IsExtensionMember = sigVal.IsExtensionMember) then err denv FSComp.SR.ValueNotContainedMutabilityExtensionsDiffer elif not (checkMemberDatasConform (err denv) (implVal.Attribs, implVal, implVal.MemberInfo) (sigVal.Attribs, sigVal, sigVal.MemberInfo)) then false diff --git a/src/Compiler/Checking/TypeHierarchy.fs b/src/Compiler/Checking/TypeHierarchy.fs index 12572e87d10..fe44b9cf874 100644 --- a/src/Compiler/Checking/TypeHierarchy.fs +++ b/src/Compiler/Checking/TypeHierarchy.fs @@ -92,8 +92,8 @@ let GetImmediateInterfacesOfMetadataType g amap m skipUnref ty (tcref: TyconRef) match metadataOfTy g ty with #if !NO_TYPEPROVIDERS | ProvidedTypeMetadata info -> - for ity in info.ProvidedType.PApplyArray((fun st -> st.GetInterfaces()), "GetInterfaces", m) do - ImportProvidedType amap m ity + for intfTy in info.ProvidedType.PApplyArray((fun st -> st.GetInterfaces()), "GetInterfaces", m) do + ImportProvidedType amap m intfTy #endif | ILTypeMetadata (TILObjectReprData(scoref, _, tdef)) -> // ImportILType may fail for an interface if the assembly load set is incomplete and the interface @@ -103,12 +103,12 @@ let GetImmediateInterfacesOfMetadataType g amap m skipUnref ty (tcref: TyconRef) // succeeded with more reported. There are pathological corner cases where this // doesn't apply: e.g. for mscorlib interfaces like IComparable, but we can always // assume those are present. - for ity in tdef.Implements do - if skipUnref = SkipUnrefInterfaces.No || CanRescopeAndImportILType scoref amap m ity then - RescopeAndImportILType scoref amap m tinst ity + for intfTy in tdef.Implements do + if skipUnref = SkipUnrefInterfaces.No || CanRescopeAndImportILType scoref amap m intfTy then + RescopeAndImportILType scoref amap m tinst intfTy | FSharpOrArrayOrByrefOrTupleOrExnTypeMetadata -> - for ity in tcref.ImmediateInterfaceTypesOfFSharpTycon do - instType (mkInstForAppTy g ty) ity ] + for intfTy in tcref.ImmediateInterfaceTypesOfFSharpTycon do + instType (mkInstForAppTy g ty) intfTy ] /// Collect the set of immediate declared interface types for an F# type, but do not /// traverse the type hierarchy to collect further interfaces. @@ -163,10 +163,10 @@ let rec GetImmediateInterfacesOfType skipUnref g amap m ty = and GetImmediateInterfacesOfMeasureAnnotatedType skipUnref g amap m ty reprTy = [ // Report any interfaces that don't derive from IComparable<_> or IEquatable<_> - for ity in GetImmediateInterfacesOfType skipUnref g amap m reprTy do - if not (ExistsHeadTypeInInterfaceHierarchy g.system_GenericIComparable_tcref skipUnref g amap m ity) && - not (ExistsHeadTypeInInterfaceHierarchy g.system_GenericIEquatable_tcref skipUnref g amap m ity) then - ity + for intfTy in GetImmediateInterfacesOfType skipUnref g amap m reprTy do + if not (ExistsHeadTypeInInterfaceHierarchy g.system_GenericIComparable_tcref skipUnref g amap m intfTy) && + not (ExistsHeadTypeInInterfaceHierarchy g.system_GenericIEquatable_tcref skipUnref g amap m intfTy) then + intfTy // NOTE: we should really only report the IComparable> interface for measure-annotated types // if the original type supports IComparable somewhere in the hierarchy, likeiwse IEquatable>. @@ -181,15 +181,15 @@ and GetImmediateInterfacesOfMeasureAnnotatedType skipUnref g amap m ty reprTy = ] // Check for IComparable, IEquatable and interfaces that derive from these -and ExistsHeadTypeInInterfaceHierarchy target skipUnref g amap m ity = - ExistsInInterfaceHierarchy (function AppTy g (tcref,_) -> tyconRefEq g tcref target | _ -> false) skipUnref g amap m ity +and ExistsHeadTypeInInterfaceHierarchy target skipUnref g amap m intfTy = + ExistsInInterfaceHierarchy (function AppTy g (tcref,_) -> tyconRefEq g tcref target | _ -> false) skipUnref g amap m intfTy // Check for IComparable, IEquatable and interfaces that derive from these -and ExistsInInterfaceHierarchy p skipUnref g amap m ity = - match ity with +and ExistsInInterfaceHierarchy p skipUnref g amap m intfTy = + match intfTy with | AppTy g (tcref, tinst) -> - p ity || - (GetImmediateInterfacesOfMetadataType g amap m skipUnref ity tcref tinst + p intfTy || + (GetImmediateInterfacesOfMetadataType g amap m skipUnref intfTy tcref tinst |> List.exists (ExistsInInterfaceHierarchy p skipUnref g amap m)) | _ -> false @@ -369,14 +369,14 @@ let CopyTyparConstraints m tprefInst (tporig: Typar) = TyparConstraint.DefaultsTo (priority, instType tprefInst ty, m) | TyparConstraint.SupportsNull _ -> TyparConstraint.SupportsNull m - | TyparConstraint.IsEnum (uty, _) -> - TyparConstraint.IsEnum (instType tprefInst uty, m) + | TyparConstraint.IsEnum (underlyingTy, _) -> + TyparConstraint.IsEnum (instType tprefInst underlyingTy, m) | TyparConstraint.SupportsComparison _ -> TyparConstraint.SupportsComparison m | TyparConstraint.SupportsEquality _ -> TyparConstraint.SupportsEquality m - | TyparConstraint.IsDelegate(aty, bty, _) -> - TyparConstraint.IsDelegate (instType tprefInst aty, instType tprefInst bty, m) + | TyparConstraint.IsDelegate(argTys, retTy, _) -> + TyparConstraint.IsDelegate (instType tprefInst argTys, instType tprefInst retTy, m) | TyparConstraint.IsNonNullableStruct _ -> TyparConstraint.IsNonNullableStruct m | TyparConstraint.IsUnmanaged _ -> diff --git a/src/Compiler/Checking/TypeRelations.fs b/src/Compiler/Checking/TypeRelations.fs index b0951fd9a79..d714e1b1a60 100644 --- a/src/Compiler/Checking/TypeRelations.fs +++ b/src/Compiler/Checking/TypeRelations.fs @@ -46,24 +46,25 @@ let rec TypeDefinitelySubsumesTypeNoCoercion ndeep g amap m ty1 ty2 = type CanCoerce = CanCoerce | NoCoerce +let stripAll stripMeasures g ty = + if stripMeasures then + ty |> stripTyEqnsWrtErasure EraseAll g |> stripMeasuresFromTy g + else + ty |> stripTyEqns g + /// The feasible equivalence relation. Part of the language spec. let rec TypesFeasiblyEquivalent stripMeasures ndeep g amap m ty1 ty2 = if ndeep > 100 then error(InternalError("recursive class hierarchy (detected in TypeFeasiblySubsumesType), ty1 = " + (DebugPrint.showType ty1), m)); - let stripAll ty = - if stripMeasures then - ty |> stripTyEqnsWrtErasure EraseAll g |> stripMeasuresFromTType g - else - ty |> stripTyEqns g - let ty1str = stripAll ty1 - let ty2str = stripAll ty2 + let ty1 = stripAll stripMeasures g ty1 + let ty2 = stripAll stripMeasures g ty2 - match ty1str, ty2str with + match ty1, ty2 with | TType_var _, _ | _, TType_var _ -> true - | TType_app (tc1, l1, _), TType_app (tc2, l2, _) when tyconRefEq g tc1 tc2 -> + | TType_app (tcref1, l1, _), TType_app (tcref2, l2, _) when tyconRefEq g tcref1 tcref2 -> List.lengthsEqAndForall2 (TypesFeasiblyEquivalent stripMeasures ndeep g amap m) l1 l2 | TType_anon (anonInfo1, l1),TType_anon (anonInfo2, l2) -> @@ -76,9 +77,9 @@ let rec TypesFeasiblyEquivalent stripMeasures ndeep g amap m ty1 ty2 = evalTupInfoIsStruct tupInfo1 = evalTupInfoIsStruct tupInfo2 && List.lengthsEqAndForall2 (TypesFeasiblyEquivalent stripMeasures ndeep g amap m) l1 l2 - | TType_fun (d1, r1, _), TType_fun (d2, r2, _) -> - TypesFeasiblyEquivalent stripMeasures ndeep g amap m d1 d2 && - TypesFeasiblyEquivalent stripMeasures ndeep g amap m r1 r2 + | TType_fun (domainTy1, rangeTy1, _), TType_fun (domainTy2, rangeTy2, _) -> + TypesFeasiblyEquivalent stripMeasures ndeep g amap m domainTy1 domainTy2 && + TypesFeasiblyEquivalent stripMeasures ndeep g amap m rangeTy1 rangeTy2 | TType_measure _, TType_measure _ -> true @@ -133,51 +134,51 @@ let rec TypeFeasiblySubsumesType ndeep g amap m ty1 canCoerce ty2 = /// Here x gets a generalized type "list<'T>". let ChooseTyparSolutionAndRange (g: TcGlobals) amap (tp:Typar) = let m = tp.Range - let max, m = - let initial = + let maxTy, m = + let initialTy = match tp.Kind with | TyparKind.Type -> g.obj_ty | TyparKind.Measure -> TType_measure Measure.One // Loop through the constraints computing the lub - ((initial, m), tp.Constraints) ||> List.fold (fun (maxSoFar, _) tpc -> + ((initialTy, m), tp.Constraints) ||> List.fold (fun (maxTy, _) tpc -> let join m x = - if TypeFeasiblySubsumesType 0 g amap m x CanCoerce maxSoFar then maxSoFar - elif TypeFeasiblySubsumesType 0 g amap m maxSoFar CanCoerce x then x - else errorR(Error(FSComp.SR.typrelCannotResolveImplicitGenericInstantiation((DebugPrint.showType x), (DebugPrint.showType maxSoFar)), m)); maxSoFar + if TypeFeasiblySubsumesType 0 g amap m x CanCoerce maxTy then maxTy + elif TypeFeasiblySubsumesType 0 g amap m maxTy CanCoerce x then x + else errorR(Error(FSComp.SR.typrelCannotResolveImplicitGenericInstantiation((DebugPrint.showType x), (DebugPrint.showType maxTy)), m)); maxTy // Don't continue if an error occurred and we set the value eagerly - if tp.IsSolved then maxSoFar, m else + if tp.IsSolved then maxTy, m else match tpc with | TyparConstraint.CoercesTo(x, m) -> join m x, m | TyparConstraint.MayResolveMember(_traitInfo, m) -> - maxSoFar, m + maxTy, m | TyparConstraint.SimpleChoice(_, m) -> errorR(Error(FSComp.SR.typrelCannotResolveAmbiguityInPrintf(), m)) - maxSoFar, m + maxTy, m | TyparConstraint.SupportsNull m -> - maxSoFar, m + maxTy, m | TyparConstraint.SupportsComparison m -> join m g.mk_IComparable_ty, m | TyparConstraint.SupportsEquality m -> - maxSoFar, m + maxTy, m | TyparConstraint.IsEnum(_, m) -> errorR(Error(FSComp.SR.typrelCannotResolveAmbiguityInEnum(), m)) - maxSoFar, m + maxTy, m | TyparConstraint.IsDelegate(_, _, m) -> errorR(Error(FSComp.SR.typrelCannotResolveAmbiguityInDelegate(), m)) - maxSoFar, m + maxTy, m | TyparConstraint.IsNonNullableStruct m -> join m g.int_ty, m | TyparConstraint.IsUnmanaged m -> errorR(Error(FSComp.SR.typrelCannotResolveAmbiguityInUnmanaged(), m)) - maxSoFar, m + maxTy, m | TyparConstraint.RequiresDefaultConstructor m -> - maxSoFar, m + maxTy, m | TyparConstraint.IsReferenceType m -> - maxSoFar, m + maxTy, m | TyparConstraint.DefaultsTo(_priority, _ty, m) -> - maxSoFar, m) - max, m + maxTy, m) + maxTy, m let ChooseTyparSolution g amap tp = let ty, _m = ChooseTyparSolutionAndRange g amap tp @@ -249,11 +250,11 @@ let tryDestTopLambda g amap (ValReprInfo (tpNames, _, _) as tvd) (e, ty) = (None, None, [], e, ty) let n = tvd.NumCurriedArgs - let tps, taue, tauty = + let tps, bodyExpr, bodyTy = match stripDebugPoints e with | Expr.TyLambda (_, tps, b, _, retTy) when not (isNil tpNames) -> tps, b, retTy | _ -> [], e, ty - let ctorThisValOpt, baseValOpt, vsl, body, retTy = startStripLambdaUpto n (taue, tauty) + let ctorThisValOpt, baseValOpt, vsl, body, retTy = startStripLambdaUpto n (bodyExpr, bodyTy) if vsl.Length <> n then None else diff --git a/src/Compiler/Checking/import.fs b/src/Compiler/Checking/import.fs index ea3dc9dbb9a..cca134f4d38 100644 --- a/src/Compiler/Checking/import.fs +++ b/src/Compiler/Checking/import.fs @@ -174,8 +174,8 @@ let rec ImportILType (env: ImportMap) m tinst ty = | ILType.Array(bounds, ty) -> let n = bounds.Rank - let elementType = ImportILType env m tinst ty - mkArrayTy env.g n elementType m + let elemTy = ImportILType env m tinst ty + mkArrayTy env.g n elemTy m | ILType.Boxed tspec | ILType.Value tspec -> let tcref = ImportILTypeRef env m tspec.TypeRef @@ -335,10 +335,10 @@ let rec ImportProvidedType (env: ImportMap) (m: range) (* (tinst: TypeInst) *) ( if tp.Kind = TyparKind.Measure then let rec conv ty = match ty with - | TType_app (tcref, [t1;t2], _) when tyconRefEq g tcref g.measureproduct_tcr -> Measure.Prod (conv t1, conv t2) - | TType_app (tcref, [t1], _) when tyconRefEq g tcref g.measureinverse_tcr -> Measure.Inv (conv t1) + | TType_app (tcref, [ty1;ty2], _) when tyconRefEq g tcref g.measureproduct_tcr -> Measure.Prod (conv ty1, conv ty2) + | TType_app (tcref, [ty1], _) when tyconRefEq g tcref g.measureinverse_tcr -> Measure.Inv (conv ty1) | TType_app (tcref, [], _) when tyconRefEq g tcref g.measureone_tcr -> Measure.One - | TType_app (tcref, [], _) when tcref.TypeOrMeasureKind = TyparKind.Measure -> Measure.Con tcref + | TType_app (tcref, [], _) when tcref.TypeOrMeasureKind = TyparKind.Measure -> Measure.Const tcref | TType_app (tcref, _, _) -> errorR(Error(FSComp.SR.impInvalidMeasureArgument1(tcref.CompiledName, tp.Name), m)) Measure.One diff --git a/src/Compiler/Checking/infos.fs b/src/Compiler/Checking/infos.fs index 28c4382f918..c5d45e95e3f 100644 --- a/src/Compiler/Checking/infos.fs +++ b/src/Compiler/Checking/infos.fs @@ -55,7 +55,7 @@ type ValRef with | Some membInfo -> not membInfo.MemberFlags.IsDispatchSlot && (match membInfo.ImplementedSlotSigs with - | TSlotSig(_, oty, _, _, _, _) :: _ -> isInterfaceTy g oty + | slotSig :: _ -> isInterfaceTy g slotSig.DeclaringType | [] -> false) member vref.ImplementedSlotSignatures = @@ -312,8 +312,8 @@ let OptionalArgInfoOfProvidedParameter (amap: ImportMap) m (provParam : Tainted< elif isObjTy g ty then MissingValue else DefaultValue - let pty = ImportProvidedType amap m (provParam.PApply((fun p -> p.ParameterType), m)) - CallerSide (analyze pty) + let paramTy = ImportProvidedType amap m (provParam.PApply((fun p -> p.ParameterType), m)) + CallerSide (analyze paramTy) | _ -> let v = provParam.PUntaint((fun p -> p.RawDefaultValue), m) CallerSide (Constant (ILFieldInit.FromProvidedObj m v)) @@ -1217,8 +1217,8 @@ type MethInfo = let formalRetTy = ImportReturnTypeFromMetadata amap m ilminfo.RawMetadata.Return.Type (fun _ -> ilminfo.RawMetadata.Return.CustomAttrs) ftinfo.ILScopeRef ftinfo.TypeInstOfRawMetadata formalMethTyparTys let formalParams = [ [ for p in ilminfo.RawMetadata.Parameters do - let paramType = ImportILTypeFromMetadataWithAttributes amap m ftinfo.ILScopeRef ftinfo.TypeInstOfRawMetadata formalMethTyparTys p.Type (fun _ -> p.CustomAttrs) - yield TSlotParam(p.Name, paramType, p.IsIn, p.IsOut, p.IsOptional, []) ] ] + let paramTy = ImportILTypeFromMetadataWithAttributes amap m ftinfo.ILScopeRef ftinfo.TypeInstOfRawMetadata formalMethTyparTys p.Type (fun _ -> p.CustomAttrs) + yield TSlotParam(p.Name, paramTy, p.IsIn, p.IsOut, p.IsOptional, []) ] ] formalRetTy, formalParams #if !NO_TYPEPROVIDERS | ProvidedMeth (_, mi, _, _) -> @@ -1230,9 +1230,9 @@ type MethInfo = let formalParams = [ [ for p in mi.PApplyArray((fun mi -> mi.GetParameters()), "GetParameters", m) do let paramName = p.PUntaint((fun p -> match p.Name with null -> None | s -> Some s), m) - let paramType = ImportProvidedType amap m (p.PApply((fun p -> p.ParameterType), m)) + let paramTy = ImportProvidedType amap m (p.PApply((fun p -> p.ParameterType), m)) let isIn, isOut, isOptional = p.PUntaint((fun p -> p.IsIn, p.IsOut, p.IsOptional), m) - yield TSlotParam(paramName, paramType, isIn, isOut, isOptional, []) ] ] + yield TSlotParam(paramName, paramTy, isIn, isOut, isOptional, []) ] ] formalRetTy, formalParams #endif | _ -> failwith "unreachable" @@ -1256,15 +1256,15 @@ type MethInfo = | ProvidedMeth(amap, mi, _, _) -> // A single set of tupled parameters [ [for p in mi.PApplyArray((fun mi -> mi.GetParameters()), "GetParameters", m) do - let pname = + let paramName = match p.PUntaint((fun p -> p.Name), m) with | null -> None | name -> Some (mkSynId m name) - let pty = + let paramTy = match p.PApply((fun p -> p.ParameterType), m) with | Tainted.Null -> amap.g.unit_ty | parameterType -> ImportProvidedType amap m parameterType - yield ParamNameAndType(pname, pty) ] ] + yield ParamNameAndType(paramName, paramTy) ] ] #endif @@ -1866,14 +1866,14 @@ type PropInfo = | ProvidedProp (_, pi, m) -> [ for p in pi.PApplyArray((fun pi -> pi.GetIndexParameters()), "GetIndexParameters", m) do let paramName = p.PUntaint((fun p -> match p.Name with null -> None | s -> Some (mkSynId m s)), m) - let paramType = ImportProvidedType amap m (p.PApply((fun p -> p.ParameterType), m)) - yield ParamNameAndType(paramName, paramType) ] + let paramTy = ImportProvidedType amap m (p.PApply((fun p -> p.ParameterType), m)) + yield ParamNameAndType(paramName, paramTy) ] #endif /// Get the details of the indexer parameters associated with the property member x.GetParamDatas(amap, m) = x.GetParamNamesAndTypes(amap, m) - |> List.map (fun (ParamNameAndType(nmOpt, pty)) -> ParamData(false, false, false, NotOptional, NoCallerInfo, nmOpt, ReflectedArgInfo.None, pty)) + |> List.map (fun (ParamNameAndType(nmOpt, paramTy)) -> ParamData(false, false, false, NotOptional, NoCallerInfo, nmOpt, ReflectedArgInfo.None, paramTy)) /// Get the types of the indexer parameters associated with the property member x.GetParamTypes(amap, m) = @@ -1908,14 +1908,16 @@ type PropInfo = /// Uses the same techniques as 'MethInfosUseIdenticalDefinitions'. /// Must be compatible with ItemsAreEffectivelyEqual relation. static member PropInfosUseIdenticalDefinitions x1 x2 = + let optVrefEq g = function - | Some v1, Some v2 -> valRefEq g v1 v2 + | Some vref1, Some vref2 -> valRefEq g vref1 vref2 | None, None -> true | _ -> false + match x1, x2 with | ILProp ilpinfo1, ILProp ilpinfo2 -> (ilpinfo1.RawMetadata === ilpinfo2.RawMetadata) | FSProp(g, _, vrefa1, vrefb1), FSProp(_, _, vrefa2, vrefb2) -> - (optVrefEq g (vrefa1, vrefa2)) && (optVrefEq g (vrefb1, vrefb2)) + optVrefEq g (vrefa1, vrefa2) && optVrefEq g (vrefb1, vrefb2) #if !NO_TYPEPROVIDERS | ProvidedProp(_, pi1, _), ProvidedProp(_, pi2, _) -> ProvidedPropertyInfo.TaintedEquals (pi1, pi2) #endif @@ -1927,7 +1929,7 @@ type PropInfo = | ILProp ilpinfo -> hash ilpinfo.RawMetadata.Name | FSProp(_, _, vrefOpt1, vrefOpt2) -> // Hash on string option * string option - let vth = (vrefOpt1 |> Option.map (fun vr -> vr.LogicalName), (vrefOpt2 |> Option.map (fun vr -> vr.LogicalName))) + let vth = (vrefOpt1 |> Option.map (fun vr -> vr.LogicalName), (vrefOpt2 |> Option.map (fun vref -> vref.LogicalName))) hash vth #if !NO_TYPEPROVIDERS | ProvidedProp(_, pi, _) -> ProvidedPropertyInfo.TaintedGetHashCode pi diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index c39508fc595..63c543cfed2 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -164,7 +164,7 @@ type AttributeDecoder(namedArgs) = let findTyconRef x = match NameMap.tryFind x nameMap with - | Some (AttribExpr (_, Expr.App (_, _, [ TType_app (tr, _, _) ], _, _))) -> Some tr + | Some (AttribExpr (_, Expr.App (_, _, [ TType_app (tcref, _, _) ], _, _))) -> Some tcref | _ -> None member _.FindInt16 x dflt = @@ -575,7 +575,7 @@ type TypeReprEnv(reprs: Map, count: int, templateReplacement: (Ty member eenv.ForTycon(tycon: Tycon) = eenv.ForTypars tycon.TyparsNoRange /// Get the environment for generating a reference to items within a type definition - member eenv.ForTyconRef(tycon: TyconRef) = eenv.ForTycon tycon.Deref + member eenv.ForTyconRef(tcref: TyconRef) = eenv.ForTycon tcref.Deref //-------------------------------------------------------------------------- // Generate type references @@ -2073,7 +2073,7 @@ type AssemblyBuilder(cenv: cenv, anonTypeTable: AnonTypeGenerationTable) as mgbu mkILFields [ for _, fldName, fldTy in flds -> - // Don't hide fields when splitting to multiple assemblies. + let access = if cenv.options.isInteractive && cenv.options.fsiMultiAssemblyEmit then ILMemberAccess.Public @@ -2081,7 +2081,8 @@ type AssemblyBuilder(cenv: cenv, anonTypeTable: AnonTypeGenerationTable) as mgbu ILMemberAccess.Private let fdef = mkILInstanceField (fldName, fldTy, None, access) - fdef.With(customAttrs = mkILCustomAttrs [ g.DebuggerBrowsableNeverAttribute ]) + let attrs = [ g.CompilerGeneratedAttribute; g.DebuggerBrowsableNeverAttribute ] + fdef.With(customAttrs = mkILCustomAttrs attrs) ] // Generate property definitions for the fields compiled as properties @@ -2171,16 +2172,16 @@ type AssemblyBuilder(cenv: cenv, anonTypeTable: AnonTypeGenerationTable) as mgbu ) let tcref = mkLocalTyconRef tycon - let typ = generalizedTyconRef g tcref + let ty = generalizedTyconRef g tcref let tcaug = tcref.TypeContents tcaug.tcaug_interfaces <- [ (g.mk_IStructuralComparable_ty, true, m) (g.mk_IComparable_ty, true, m) - (mkAppTy g.system_GenericIComparable_tcref [ typ ], true, m) + (mkAppTy g.system_GenericIComparable_tcref [ ty ], true, m) (g.mk_IStructuralEquatable_ty, true, m) - (mkAppTy g.system_GenericIEquatable_tcref [ typ ], true, m) + (mkAppTy g.system_GenericIEquatable_tcref [ ty ], true, m) ] let vspec1, vspec2 = AugmentWithHashCompare.MakeValsForEqualsAugmentation g tcref @@ -2209,7 +2210,7 @@ type AssemblyBuilder(cenv: cenv, anonTypeTable: AnonTypeGenerationTable) as mgbu let ilInterfaceTys = [ - for ity, _, _ in tcaug.tcaug_interfaces -> GenType cenv m (TypeReprEnv.Empty.ForTypars tps) ity + for intfTy, _, _ in tcaug.tcaug_interfaces -> GenType cenv m (TypeReprEnv.Empty.ForTypars tps) intfTy ] let ilTypeDef = @@ -2973,7 +2974,7 @@ and GenExprAux (cenv: cenv) (cgbuf: CodeGenBuffer) eenv expr (sequel: sequel) = match op, args, tyargs with | TOp.ExnConstr c, _, _ -> GenAllocExn cenv cgbuf eenv (c, args, m) sequel | TOp.UnionCase c, _, _ -> GenAllocUnionCase cenv cgbuf eenv (c, tyargs, args, m) sequel - | TOp.Recd (isCtor, tycon), _, _ -> GenAllocRecd cenv cgbuf eenv isCtor (tycon, tyargs, args, m) sequel + | TOp.Recd (isCtor, tcref), _, _ -> GenAllocRecd cenv cgbuf eenv isCtor (tcref, tyargs, args, m) sequel | TOp.AnonRecd anonInfo, _, _ -> GenAllocAnonRecd cenv cgbuf eenv (anonInfo, tyargs, args, m) sequel | TOp.AnonRecdGet (anonInfo, n), [ e ], _ -> GenGetAnonRecdField cenv cgbuf eenv (anonInfo, e, tyargs, n, m) sequel | TOp.TupleFieldGet (tupInfo, n), [ e ], _ -> GenGetTupleField cenv cgbuf eenv (tupInfo, e, tyargs, n, m) sequel @@ -3000,10 +3001,10 @@ and GenExprAux (cenv: cenv) (cgbuf: CodeGenBuffer) eenv expr (sequel: sequel) = [] -> GenIntegerForLoop cenv cgbuf eenv (spFor, spTo, v, e1, dir, e2, e3, m) sequel | TOp.TryFinally (spTry, spFinally), [ Expr.Lambda (_, _, _, [ _ ], e1, _, _); Expr.Lambda (_, _, _, [ _ ], e2, _, _) ], - [ resty ] -> GenTryFinally cenv cgbuf eenv (e1, e2, m, resty, spTry, spFinally) sequel + [ resTy ] -> GenTryFinally cenv cgbuf eenv (e1, e2, m, resTy, spTry, spFinally) sequel | TOp.TryWith (spTry, spWith), [ Expr.Lambda (_, _, _, [ _ ], e1, _, _); Expr.Lambda (_, _, _, [ vf ], ef, _, _); Expr.Lambda (_, _, _, [ vh ], eh, _, _) ], - [ resty ] -> GenTryWith cenv cgbuf eenv (e1, vf, ef, vh, eh, m, resty, spTry, spWith) sequel + [ resTy ] -> GenTryWith cenv cgbuf eenv (e1, vf, ef, vh, eh, m, resTy, spTry, spWith) sequel | TOp.ILCall (isVirtual, _, isStruct, isCtor, valUseFlag, _, noTailCall, ilMethRef, enclTypeInst, methInst, returnTypes), args, [] -> @@ -3014,8 +3015,8 @@ and GenExprAux (cenv: cenv) (cgbuf: CodeGenBuffer) eenv expr (sequel: sequel) = (isVirtual, isStruct, isCtor, valUseFlag, noTailCall, ilMethRef, enclTypeInst, methInst, args, returnTypes, m) sequel | TOp.RefAddrGet _readonly, [ e ], [ ty ] -> GenGetAddrOfRefCellField cenv cgbuf eenv (e, ty, m) sequel - | TOp.Coerce, [ e ], [ tgty; srcty ] -> GenCoerce cenv cgbuf eenv (e, tgty, m, srcty) sequel - | TOp.Reraise, [], [ rtnty ] -> GenReraise cenv cgbuf eenv (rtnty, m) sequel + | TOp.Coerce, [ e ], [ tgtTy; srcTy ] -> GenCoerce cenv cgbuf eenv (e, tgtTy, m, srcTy) sequel + | TOp.Reraise, [], [ retTy ] -> GenReraise cenv cgbuf eenv (retTy, m) sequel | TOp.TraitCall traitInfo, args, [] -> GenTraitCall cenv cgbuf eenv (traitInfo, args, m) expr sequel | TOp.LValueOp (LSet, v), [ e ], [] -> GenSetVal cenv cgbuf eenv (v, e, m) sequel | TOp.LValueOp (LByrefGet, v), [], [] -> GenGetByref cenv cgbuf eenv (v, m) sequel @@ -3285,17 +3286,17 @@ and GenGetTupleField cenv cgbuf eenv (tupInfo, e, tys, n, m) sequel = if ar <= 0 then failwith "getCompiledTupleItem" elif ar < maxTuple then - let tcr' = mkCompiledTupleTyconRef g tupInfo ar - let ty = GenNamedTyApp cenv m eenv.tyenv tcr' tys + let tcref = mkCompiledTupleTyconRef g tupInfo ar + let ty = GenNamedTyApp cenv m eenv.tyenv tcref tys mkGetTupleItemN g m n ty tupInfo e tys[n] else let tysA, tysB = List.splitAfter goodTupleFields tys let tyB = mkCompiledTupleTy g tupInfo tysB - let tys' = tysA @ [ tyB ] - let tcr' = mkCompiledTupleTyconRef g tupInfo (List.length tys') - let ty' = GenNamedTyApp cenv m eenv.tyenv tcr' tys' - let n' = (min n goodTupleFields) - let elast = mkGetTupleItemN g m n' ty' tupInfo e tys'[n'] + let tysC = tysA @ [ tyB ] + let tcref = mkCompiledTupleTyconRef g tupInfo (List.length tysC) + let tyR = GenNamedTyApp cenv m eenv.tyenv tcref tysC + let nR = min n goodTupleFields + let elast = mkGetTupleItemN g m nR tyR tupInfo e tysC[nR] if n < goodTupleFields then elast @@ -3682,18 +3683,18 @@ and GenNewArray cenv cgbuf eenv (elems: Expr list, elemTy, m) sequel = else GenNewArraySimple cenv cgbuf eenv (elems, elemTy, m) sequel -and GenCoerce cenv cgbuf eenv (e, tgty, m, srcty) sequel = +and GenCoerce cenv cgbuf eenv (e, tgtTy, m, srcTy) sequel = let g = cenv.g // Is this an upcast? if - TypeDefinitelySubsumesTypeNoCoercion 0 g cenv.amap m tgty srcty + TypeDefinitelySubsumesTypeNoCoercion 0 g cenv.amap m tgtTy srcTy && // Do an extra check - should not be needed - TypeFeasiblySubsumesType 0 g cenv.amap m tgty NoCoerce srcty + TypeFeasiblySubsumesType 0 g cenv.amap m tgtTy NoCoerce srcTy then - if isInterfaceTy g tgty then + if isInterfaceTy g tgtTy then GenExpr cenv cgbuf eenv e Continue - let ilToTy = GenType cenv m eenv.tyenv tgty + let ilToTy = GenType cenv m eenv.tyenv tgtTy // Section "III.1.8.1.3 Merging stack states" of ECMA-335 implies that no unboxing // is required, but we still push the coerced type on to the code gen buffer. CG.EmitInstrs cgbuf (pop 1) (Push [ ilToTy ]) [] @@ -3703,18 +3704,18 @@ and GenCoerce cenv cgbuf eenv (e, tgty, m, srcty) sequel = else GenExpr cenv cgbuf eenv e Continue - if not (isObjTy g srcty) then - let ilFromTy = GenType cenv m eenv.tyenv srcty + if not (isObjTy g srcTy) then + let ilFromTy = GenType cenv m eenv.tyenv srcTy CG.EmitInstr cgbuf (pop 1) (Push [ g.ilg.typ_Object ]) (I_box ilFromTy) - if not (isObjTy g tgty) then - let ilToTy = GenType cenv m eenv.tyenv tgty + if not (isObjTy g tgtTy) then + let ilToTy = GenType cenv m eenv.tyenv tgtTy CG.EmitInstr cgbuf (pop 1) (Push [ ilToTy ]) (I_unbox_any ilToTy) GenSequel cenv eenv.cloc cgbuf sequel -and GenReraise cenv cgbuf eenv (rtnty, m) sequel = - let ilReturnTy = GenType cenv m eenv.tyenv rtnty +and GenReraise cenv cgbuf eenv (retTy, m) sequel = + let ilReturnTy = GenType cenv m eenv.tyenv retTy CG.EmitInstr cgbuf (pop 0) Push0 I_rethrow // [See comment related to I_throw]. // Rethrow does not return. Required to push dummy value on the stack. @@ -4538,14 +4539,14 @@ and GenNamedLocalTyFuncCall cenv (cgbuf: CodeGenBuffer) eenv ty cloinfo tyargs m actualRetTy /// Generate an indirect call, converting to an ILX callfunc instruction -and GenCurriedArgsAndIndirectCall cenv cgbuf eenv (functy, tyargs, curriedArgs, m) sequel = +and GenCurriedArgsAndIndirectCall cenv cgbuf eenv (funcTy, tyargs, curriedArgs, m) sequel = // Generate the curried arguments to the indirect call GenExprs cenv cgbuf eenv curriedArgs - GenIndirectCall cenv cgbuf eenv (functy, tyargs, curriedArgs, m) sequel + GenIndirectCall cenv cgbuf eenv (funcTy, tyargs, curriedArgs, m) sequel /// Generate an indirect call, converting to an ILX callfunc instruction -and GenIndirectCall cenv cgbuf eenv (functy, tyargs, curriedArgs, m) sequel = +and GenIndirectCall cenv cgbuf eenv (funcTy, tyargs, curriedArgs, m) sequel = let g = cenv.g // Fold in the new types into the environment as we generate the formal types. @@ -4553,7 +4554,7 @@ and GenIndirectCall cenv cgbuf eenv (functy, tyargs, curriedArgs, m) sequel = // keep only non-erased type arguments when computing indirect call let tyargs = DropErasedTyargs tyargs - let typars, formalFuncTy = tryDestForallTy g functy + let typars, formalFuncTy = tryDestForallTy g funcTy let feenv = eenv.tyenv.Add typars @@ -4568,7 +4569,7 @@ and GenIndirectCall cenv cgbuf eenv (functy, tyargs, curriedArgs, m) sequel = List.foldBack (fun tyarg acc -> Apps_tyapp(GenType cenv m eenv.tyenv tyarg, acc)) tyargs (appBuilder ilxRetApps) - let actualRetTy = applyTys g functy (tyargs, curriedArgs) + let actualRetTy = applyTys g funcTy (tyargs, curriedArgs) let ilActualRetTy = GenType cenv m eenv.tyenv actualRetTy // Check if any byrefs are involved to make sure we don't tailcall @@ -4710,14 +4711,14 @@ and eligibleForFilter (cenv: cenv) expr = && not isTrivial && check expr -and GenTryWith cenv cgbuf eenv (e1, valForFilter: Val, filterExpr, valForHandler: Val, handlerExpr, m, resty, spTry, spWith) sequel = +and GenTryWith cenv cgbuf eenv (e1, valForFilter: Val, filterExpr, valForHandler: Val, handlerExpr, m, resTy, spTry, spWith) sequel = let g = cenv.g // Save the stack - gross because IL flushes the stack at the exn. handler // note: eenvinner notes spill vars are live LocalScope "trystack" cgbuf (fun scopeMarks -> let whereToSaveOpt, eenvinner, stack, tryMarks, afterHandler = - GenTry cenv cgbuf eenv scopeMarks (e1, m, resty, spTry) + GenTry cenv cgbuf eenv scopeMarks (e1, m, resTy, spTry) let seh = if cenv.options.generateFilterBlocks || eligibleForFilter cenv filterExpr then @@ -4824,13 +4825,13 @@ and GenTryWith cenv cgbuf eenv (e1, valForFilter: Val, filterExpr, valForHandler GenSequel cenv eenv.cloc cgbuf sequel | None -> GenUnitThenSequel cenv eenv m eenv.cloc cgbuf sequel) -and GenTryFinally cenv cgbuf eenv (bodyExpr, handlerExpr, m, resty, spTry, spFinally) sequel = +and GenTryFinally cenv cgbuf eenv (bodyExpr, handlerExpr, m, resTy, spTry, spFinally) sequel = // Save the stack - needed because IL flushes the stack at the exn. handler // note: eenvinner notes spill vars are live LocalScope "trystack" cgbuf (fun scopeMarks -> let whereToSaveOpt, eenvinner, stack, tryMarks, afterHandler = - GenTry cenv cgbuf eenv scopeMarks (bodyExpr, m, resty, spTry) + GenTry cenv cgbuf eenv scopeMarks (bodyExpr, m, resTy, spTry) // Now the catch/finally block let startOfHandler = CG.GenerateMark cgbuf "startOfHandler" @@ -7520,8 +7521,8 @@ and GenDecisionTreeSwitch CG.EmitInstr cgbuf (pop 1) (Push [ g.ilg.typ_Object ]) (I_box ilFromTy) BI_brfalse - | DecisionTreeTest.IsInst (_srcty, tgty) -> - let e = mkCallTypeTest g m tgty e + | DecisionTreeTest.IsInst (_srcTy, tgtTy) -> + let e = mkCallTypeTest g m tgtTy e GenExpr cenv cgbuf eenv e Continue BI_brtrue | _ -> failwith "internal error: GenDecisionTreeSwitch" @@ -9472,7 +9473,7 @@ and AllocLocal cenv cgbuf eenv compgen (v, ty, isFixed) (scopeMarks: Mark * Mark let j, realloc = if cenv.options.localOptimizationsEnabled then cgbuf.ReallocLocal( - (fun i (_, ty', isFixed') -> not isFixed' && not isFixed && not (IntMap.mem i eenv.liveLocals) && (ty = ty')), + (fun i (_, ty2, isFixed2) -> not isFixed2 && not isFixed && not (IntMap.mem i eenv.liveLocals) && (ty = ty2)), ranges, ty, isFixed @@ -10470,7 +10471,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = for slotsig in memberInfo.ImplementedSlotSigs do - if isInterfaceTy g slotsig.ImplementedType then + if isInterfaceTy g slotsig.DeclaringType then match vref.ValReprInfo with | Some _ -> @@ -10676,7 +10677,8 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = let extraAttribs = match tyconRepr with - | TFSharpRecdRepr _ when not useGenuineField -> [ g.DebuggerBrowsableNeverAttribute ] // hide fields in records in debug display + | TFSharpRecdRepr _ when not useGenuineField -> + [ g.CompilerGeneratedAttribute; g.DebuggerBrowsableNeverAttribute ] | _ -> [] // don't hide fields in classes in debug display let access = ComputeMemberAccess isFieldHidden diff --git a/src/Compiler/Driver/CompilerDiagnostics.fs b/src/Compiler/Driver/CompilerDiagnostics.fs index fba0a064091..056f2f19a78 100644 --- a/src/Compiler/Driver/CompilerDiagnostics.fs +++ b/src/Compiler/Driver/CompilerDiagnostics.fs @@ -124,6 +124,7 @@ let GetRangeOfDiagnostic (diagnostic: PhasedDiagnostic) = | LetRecCheckedAtRuntime m | UpperCaseIdentifierInPattern m | NotUpperCaseConstructor m + | NotUpperCaseConstructorWithoutRQA m | RecursiveUseCheckedAtRuntime (_, _, m) | LetRecEvaluatedOutOfOrder (_, _, _, m) | DiagnosticWithText (_, _, m) @@ -270,6 +271,7 @@ let GetDiagnosticNumber (diagnostic: PhasedDiagnostic) = | UseOfAddressOfOperator _ -> 51 | DefensiveCopyWarning _ -> 52 | NotUpperCaseConstructor _ -> 53 + | NotUpperCaseConstructorWithoutRQA _ -> 53 | TypeIsImplicitlyAbstract _ -> 54 // 55 cannot be reused | DeprecatedThreadStaticBindingWarning _ -> 56 @@ -435,6 +437,7 @@ let ErrorFromApplyingDefault2E () = Message("ErrorFromApplyingDefault2", "") let ErrorsFromAddingSubsumptionConstraintE () = Message("ErrorsFromAddingSubsumptionConstraint", "%s%s%s") let UpperCaseIdentifierInPatternE () = Message("UpperCaseIdentifierInPattern", "") let NotUpperCaseConstructorE () = Message("NotUpperCaseConstructor", "") +let NotUpperCaseConstructorWithoutRQAE () = Message("NotUpperCaseConstructorWithoutRQA", "") let FunctionExpectedE () = Message("FunctionExpected", "") let BakedInMemberConstraintNameE () = Message("BakedInMemberConstraintName", "%s") let BadEventTransformationE () = Message("BadEventTransformation", "") @@ -771,6 +774,8 @@ let OutputPhasedErrorR (os: StringBuilder) (diagnostic: PhasedDiagnostic) (canSu | NotUpperCaseConstructor _ -> os.AppendString(NotUpperCaseConstructorE().Format) + | NotUpperCaseConstructorWithoutRQA _ -> os.AppendString(NotUpperCaseConstructorWithoutRQAE().Format) + | ErrorFromAddingConstraint (_, e, _) -> OutputExceptionR os e #if !NO_TYPEPROVIDERS @@ -895,7 +900,8 @@ let OutputPhasedErrorR (os: StringBuilder) (diagnostic: PhasedDiagnostic) (canSu | ParameterlessStructCtor _ -> os.AppendString(ParameterlessStructCtorE().Format) - | InterfaceNotRevealed (denv, ity, _) -> os.AppendString(InterfaceNotRevealedE().Format(NicePrint.minimalStringOfType denv ity)) + | InterfaceNotRevealed (denv, intfTy, _) -> + os.AppendString(InterfaceNotRevealedE().Format(NicePrint.minimalStringOfType denv intfTy)) | NotAFunctionButIndexer (_, _, name, _, _, old) -> if old then @@ -1501,7 +1507,7 @@ let OutputPhasedErrorR (os: StringBuilder) (diagnostic: PhasedDiagnostic) (canSu |> List.exists (function | TType_app (maybeUnit, [], _) -> match maybeUnit.TypeAbbrev with - | Some ttype when isUnitTy g ttype -> true + | Some ty when isUnitTy g ty -> true | _ -> false | _ -> false) @@ -1689,7 +1695,7 @@ let OutputPhasedErrorR (os: StringBuilder) (diagnostic: PhasedDiagnostic) (canSu | PatternMatchCompilation.RuleNeverMatched _ -> os.AppendString(RuleNeverMatchedE().Format) - | ValNotMutable (_, valRef, _) -> os.AppendString(ValNotMutableE().Format(valRef.DisplayName)) + | ValNotMutable (_, vref, _) -> os.AppendString(ValNotMutableE().Format(vref.DisplayName)) | ValNotLocal _ -> os.AppendString(ValNotLocalE().Format) diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index a6ce206cc8f..97e24679878 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -1543,6 +1543,7 @@ featureStructActivePattern,"struct representation for active patterns" featureRelaxWhitespace2,"whitespace relaxation v2" featureReallyLongList,"list literals of any size" featureErrorOnDeprecatedRequireQualifiedAccess,"give error on deprecated access of construct with RequireQualifiedAccess attribute" +featureLowercaseDUWhenRequireQualifiedAccess,"Allow lowercase DU when RequireQualifiedAccess attribute" 3353,fsiInvalidDirective,"Invalid directive '#%s %s'" 3354,tcNotAFunctionButIndexerNamedIndexingNotYetEnabled,"This value supports indexing, e.g. '%s.[index]'. The syntax '%s[index]' requires /langversion:preview. See https://aka.ms/fsharp-index-notation." 3354,tcNotAFunctionButIndexerIndexingNotYetEnabled,"This expression supports indexing, e.g. 'expr.[index]'. The syntax 'expr[index]' requires /langversion:preview. See https://aka.ms/fsharp-index-notation." diff --git a/src/Compiler/FSStrings.resx b/src/Compiler/FSStrings.resx index bf1c66b0f29..51f172fbbea 100644 --- a/src/Compiler/FSStrings.resx +++ b/src/Compiler/FSStrings.resx @@ -1107,4 +1107,7 @@ internal error: {0} + + Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + \ No newline at end of file diff --git a/src/Compiler/Facilities/LanguageFeatures.fs b/src/Compiler/Facilities/LanguageFeatures.fs index a0033a5d2b7..77b93032baa 100644 --- a/src/Compiler/Facilities/LanguageFeatures.fs +++ b/src/Compiler/Facilities/LanguageFeatures.fs @@ -49,6 +49,7 @@ type LanguageFeature = | DelegateTypeNameResolutionFix | ReallyLongLists | ErrorOnDeprecatedRequireQualifiedAccess + | LowercaseDUWhenRequireQualifiedAccess /// LanguageVersion management type LanguageVersion(versionText) = @@ -111,6 +112,7 @@ type LanguageVersion(versionText) = LanguageFeature.BetterExceptionPrinting, previewVersion LanguageFeature.ReallyLongLists, previewVersion LanguageFeature.ErrorOnDeprecatedRequireQualifiedAccess, previewVersion + LanguageFeature.LowercaseDUWhenRequireQualifiedAccess, previewVersion ] static let defaultLanguageVersion = LanguageVersion("default") @@ -210,6 +212,7 @@ type LanguageVersion(versionText) = | LanguageFeature.DelegateTypeNameResolutionFix -> FSComp.SR.featureDelegateTypeNameResolutionFix () | LanguageFeature.ReallyLongLists -> FSComp.SR.featureReallyLongList () | LanguageFeature.ErrorOnDeprecatedRequireQualifiedAccess -> FSComp.SR.featureErrorOnDeprecatedRequireQualifiedAccess () + | LanguageFeature.LowercaseDUWhenRequireQualifiedAccess -> FSComp.SR.featureLowercaseDUWhenRequireQualifiedAccess () /// Get a version string associated with the given feature. member _.GetFeatureVersionString feature = diff --git a/src/Compiler/Facilities/LanguageFeatures.fsi b/src/Compiler/Facilities/LanguageFeatures.fsi index ec884903b49..8227c947c77 100644 --- a/src/Compiler/Facilities/LanguageFeatures.fsi +++ b/src/Compiler/Facilities/LanguageFeatures.fsi @@ -39,6 +39,7 @@ type LanguageFeature = | DelegateTypeNameResolutionFix | ReallyLongLists | ErrorOnDeprecatedRequireQualifiedAccess + | LowercaseDUWhenRequireQualifiedAccess /// LanguageVersion management type LanguageVersion = diff --git a/src/Compiler/Facilities/TextLayoutRender.fs b/src/Compiler/Facilities/TextLayoutRender.fs index 1b77bd9e6ae..e9b7cd8637a 100644 --- a/src/Compiler/Facilities/TextLayoutRender.fs +++ b/src/Compiler/Facilities/TextLayoutRender.fs @@ -204,5 +204,5 @@ module LayoutRender = let toArray layout = let output = ResizeArray() - renderL (taggedTextListR (fun tt -> output.Add(tt))) layout |> ignore + renderL (taggedTextListR output.Add) layout |> ignore output.ToArray() diff --git a/src/Compiler/Interactive/fsi.fs b/src/Compiler/Interactive/fsi.fs index 936343a7036..5d8966fd9a1 100644 --- a/src/Compiler/Interactive/fsi.fs +++ b/src/Compiler/Interactive/fsi.fs @@ -1814,9 +1814,9 @@ type internal FsiDynamicCompiler( ilTy |> Morphs.morphILTypeRefsInILType emEnv.ReverseMapTypeRef | _ -> ilTy) - ((istate, []), ilTys) ||> List.fold (fun (state, addedTypes) ilTy -> - let nextState, addedType = addTypeToEnvironment state ilTy - nextState, addedTypes @ [addedType]) + ((istate, []), ilTys) ||> List.fold (fun (state, addedTys) ilTy -> + let nextState, addedTy = addTypeToEnvironment state ilTy + nextState, addedTys @ [addedTy]) member _.DynamicAssemblies = dynamicAssemblies.ToArray() diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index 90e79010ed6..f4462122337 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -606,9 +606,9 @@ let inline BindInternalValsToUnknown cenv vs env = ignore vs env -let BindTypeVar tyv typeinfo env = { env with typarInfos= (tyv, typeinfo) :: env.typarInfos } +let BindTypar tyv typeinfo env = { env with typarInfos= (tyv, typeinfo) :: env.typarInfos } -let BindTypeVarsToUnknown (tps: Typar list) env = +let BindTyparsToUnknown (tps: Typar list) env = if isNil tps then env else // The optimizer doesn't use the type values it could track. // However here we mutate to provide better names for generalized type parameters @@ -617,7 +617,7 @@ let BindTypeVarsToUnknown (tps: Typar list) env = (tps, nms) ||> List.iter2 (fun tp nm -> if PrettyTypes.NeedsPrettyTyparName tp then tp.typar_id <- ident (nm, tp.Range)) - List.fold (fun sofar arg -> BindTypeVar arg UnknownTypeValue sofar) env tps + List.fold (fun sofar arg -> BindTypar arg UnknownTypeValue sofar) env tps let BindCcu (ccu: CcuThunk) mval env (_g: TcGlobals) = { env with globalModuleInfos=env.globalModuleInfos.Add(ccu.AssemblyName, mval) } @@ -2245,8 +2245,8 @@ let TryDetectQueryQuoteAndRun cenv (expr: Expr) = match reqdResultInfo, exprIsEnumerableInfo with | Some _, Some _ | None, None -> resultExpr // the expression is a QuerySource, the result is a QuerySource, nothing to do | Some resultElemTy, None -> - let iety = TType_app(g.tcref_System_Collections_IEnumerable, [], g.knownWithoutNull) - mkCallGetQuerySourceAsEnumerable g expr.Range resultElemTy iety resultExpr + let enumerableTy = TType_app(g.tcref_System_Collections_IEnumerable, [], g.knownWithoutNull) + mkCallGetQuerySourceAsEnumerable g expr.Range resultElemTy enumerableTy resultExpr | None, Some (resultElemTy, qTy) -> mkCallNewQuerySource g expr.Range resultElemTy qTy resultExpr Some resultExprAfterConvertToResultTy @@ -2425,7 +2425,7 @@ and OptimizeMethods cenv env baseValOpt methods = and OptimizeMethod cenv env baseValOpt (TObjExprMethod(slotsig, attribs, tps, vs, e, m) as tmethod) = let env = {env with latestBoundId=Some tmethod.Id; functionVal = None} - let env = BindTypeVarsToUnknown tps env + let env = BindTyparsToUnknown tps env let env = BindInternalValsToUnknown cenv vs env let env = Option.foldBack (BindInternalValToUnknown cenv) baseValOpt env let eR, einfo = OptimizeExpr cenv env e @@ -2508,11 +2508,11 @@ and OptimizeExprOp cenv env (op, tyargs, args, m) = // Special cases match op, tyargs, args with - | TOp.Coerce, [toty;fromty], [arg] -> + | TOp.Coerce, [tgtTy; srcTy], [arg] -> let argR, einfo = OptimizeExpr cenv env arg - if typeEquiv g toty fromty then argR, einfo + if typeEquiv g tgtTy srcTy then argR, einfo else - mkCoerceExpr(argR, toty, m, fromty), + mkCoerceExpr(argR, tgtTy, m, srcTy), { TotalSize=einfo.TotalSize + 1 FunctionSize=einfo.FunctionSize + 1 HasEffect = true @@ -3742,7 +3742,7 @@ and OptimizeLambdas (vspec: Val option) cenv env valReprInfo expr exprTy = let env = { env with functionVal = (match vspec with None -> None | Some v -> Some (v, valReprInfo)) } let env = Option.foldBack (BindInternalValToUnknown cenv) ctorThisValOpt env let env = Option.foldBack (BindInternalValToUnknown cenv) baseValOpt env - let env = BindTypeVarsToUnknown tps env + let env = BindTyparsToUnknown tps env let env = List.foldBack (BindInternalValsToUnknown cenv) vsl env let bodyR, bodyinfo = OptimizeExpr cenv env body let exprR = mkMemberLambdas g m tps ctorThisValOpt baseValOpt vsl (bodyR, bodyTy) @@ -3977,7 +3977,7 @@ and TryOptimizeDecisionTreeTest cenv test vinfo = | DecisionTreeTest.ArrayLength _, _ -> None | DecisionTreeTest.Const c1, StripConstValue c2 -> if c1 = Const.Zero || c2 = Const.Zero then None else Some(c1=c2) | DecisionTreeTest.IsNull, StripConstValue c2 -> Some(c2=Const.Zero) - | DecisionTreeTest.IsInst (_srcty1, _tgty1), _ -> None + | DecisionTreeTest.IsInst (_srcTy1, _tgtTy1), _ -> None // These should not occur in optimization | DecisionTreeTest.ActivePatternCase _, _ -> None | _ -> None @@ -3989,8 +3989,8 @@ and OptimizeSwitch cenv env (e, cases, dflt, m) = // Replace IsInst tests by calls to the helper for type tests, which may then get optimized let e, cases = match cases with - | [ TCase(DecisionTreeTest.IsInst (_srcTy, tgTy), success)] -> - let testExpr = mkCallTypeTest g m tgTy e + | [ TCase(DecisionTreeTest.IsInst (_srcTy, tgtTy), success)] -> + let testExpr = mkCallTypeTest g m tgtTy e let testCases = [TCase(DecisionTreeTest.Const(Const.Bool true), success)] testExpr, testCases | _ -> e, cases diff --git a/src/Compiler/Service/FSharpCheckerResults.fs b/src/Compiler/Service/FSharpCheckerResults.fs index c7f4e0ce0f0..c6ba1fd081f 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fs +++ b/src/Compiler/Service/FSharpCheckerResults.fs @@ -351,13 +351,13 @@ type internal TypeCheckInfo // Find the most deeply nested enclosing scope that contains given position sResolutions.CapturedEnvs - |> ResizeArray.iter (fun (possm, env, ad) -> - if rangeContainsPos possm cursorPos then + |> ResizeArray.iter (fun (mPossible, env, ad) -> + if rangeContainsPos mPossible cursorPos then match bestSoFar with | Some (bestm, _, _) -> - if rangeContainsRange bestm possm then - bestSoFar <- Some(possm, env, ad) - | None -> bestSoFar <- Some(possm, env, ad)) + if rangeContainsRange bestm mPossible then + bestSoFar <- Some(mPossible, env, ad) + | None -> bestSoFar <- Some(mPossible, env, ad)) let mostDeeplyNestedEnclosingScope = bestSoFar @@ -370,12 +370,12 @@ type internal TypeCheckInfo let mutable bestAlmostIncludedSoFar = None sResolutions.CapturedEnvs - |> ResizeArray.iter (fun (possm, env, ad) -> + |> ResizeArray.iter (fun (mPossible, env, ad) -> // take only ranges that strictly do not include cursorPos (all ranges that touch cursorPos were processed during 'Strict Inclusion' part) - if rangeBeforePos possm cursorPos && not (posEq possm.End cursorPos) then + if rangeBeforePos mPossible cursorPos && not (posEq mPossible.End cursorPos) then let contained = match mostDeeplyNestedEnclosingScope with - | Some (bestm, _, _) -> rangeContainsRange bestm possm + | Some (bestm, _, _) -> rangeContainsRange bestm mPossible | None -> true if contained then diff --git a/src/Compiler/Service/ItemKey.fs b/src/Compiler/Service/ItemKey.fs index 261d6ec094f..d2621715b10 100644 --- a/src/Compiler/Service/ItemKey.fs +++ b/src/Compiler/Service/ItemKey.fs @@ -241,10 +241,10 @@ and [] ItemKeyStoreBuilder() = writeString anonInfo.ILTypeRef.BasicQualifiedName tinst |> List.iter (writeType false) - | TType_fun (d, r, _) -> + | TType_fun (domainTy, rangeTy, _) -> writeString ItemKeyTags.typeFunction - writeType false d - writeType false r + writeType false domainTy + writeType false rangeTy | TType_measure ms -> if isStandalone then @@ -265,7 +265,7 @@ and [] ItemKeyStoreBuilder() = | Measure.Var typar -> writeString ItemKeyTags.typeMeasureVar writeTypar isStandalone typar - | Measure.Con tcref -> + | Measure.Const tcref -> writeString ItemKeyTags.typeMeasureCon writeEntityRef tcref | _ -> () diff --git a/src/Compiler/Service/SemanticClassification.fs b/src/Compiler/Service/SemanticClassification.fs index bdbc73d783a..fc4f9d21b75 100644 --- a/src/Compiler/Service/SemanticClassification.fs +++ b/src/Compiler/Service/SemanticClassification.fs @@ -152,8 +152,8 @@ module TcResolutionsExtensions = protectAssemblyExplorationNoReraise false false (fun () -> ExistsHeadTypeInEntireHierarchy g amap range0 vref.Type g.tcref_System_IDisposable) - let isStructTyconRef (tyconRef: TyconRef) = - let ty = generalizedTyconRef g tyconRef + let isStructTyconRef (tcref: TyconRef) = + let ty = generalizedTyconRef g tcref let underlyingTy = stripTyEqnsAndMeasureEqns g ty isStructTy g underlyingTy diff --git a/src/Compiler/Service/ServiceDeclarationLists.fs b/src/Compiler/Service/ServiceDeclarationLists.fs index 82fc0afae36..30d024d646a 100644 --- a/src/Compiler/Service/ServiceDeclarationLists.fs +++ b/src/Compiler/Service/ServiceDeclarationLists.fs @@ -197,15 +197,15 @@ module DeclarationListHelpers = | Item.ActivePatternCase apref -> let v = apref.ActivePatternVal // Format the type parameters to get e.g. ('a -> 'a) rather than ('?1234 -> '?1234) - let tau = v.TauType + let vTauTy = v.TauType // REVIEW: use _cxs here - let (prettyTyparInst, ptau), _cxs = PrettyTypes.PrettifyInstAndType denv.g (item.TyparInstantiation, tau) + let (prettyTyparInst, prettyTy), _cxs = PrettyTypes.PrettifyInstAndType denv.g (item.TyparInstantiation, vTauTy) let remarks = OutputFullName displayFullName pubpathOfValRef fullDisplayTextOfValRefAsLayout v let layout = wordL (tagText (FSComp.SR.typeInfoActiveRecognizer())) ^^ wordL (tagActivePatternCase apref.Name |> mkNav v.DefinitionRange) ^^ RightL.colon ^^ - NicePrint.layoutType denv ptau + NicePrint.layoutType denv prettyTy let tpsL = FormatTyparMapping denv prettyTyparInst @@ -292,7 +292,7 @@ module DeclarationListHelpers = // .NET events | Item.Event einfo -> - let eventTy = PropTypOfEventInfo infoReader m AccessibleFromSomewhere einfo + let eventTy = PropTypeOfEventInfo infoReader m AccessibleFromSomewhere einfo let eventTy, _cxs = PrettyTypes.PrettifyType g eventTy let layout = wordL (tagText (FSComp.SR.typeInfoEvent())) ^^ @@ -353,11 +353,11 @@ module DeclarationListHelpers = ToolTipElement.Single(layout, xml) // The 'fake' representation of constructors of .NET delegate types - | Item.DelegateCtor delty -> - let delty, _cxs = PrettyTypes.PrettifyType g delty - let (SigOfFunctionForDelegate(_, _, _, delFuncTy)) = GetSigOfFunctionForDelegate infoReader delty m AccessibleFromSomewhere + | Item.DelegateCtor delTy -> + let delTy, _cxs = PrettyTypes.PrettifyType g delTy + let (SigOfFunctionForDelegate(_, _, _, delFuncTy)) = GetSigOfFunctionForDelegate infoReader delTy m AccessibleFromSomewhere let layout = - NicePrint.layoutTyconRef denv (tcrefOfAppTy g delty) ^^ + NicePrint.layoutTyconRef denv (tcrefOfAppTy g delTy) ^^ LeftL.leftParen ^^ NicePrint.layoutType denv delFuncTy ^^ RightL.rightParen @@ -484,16 +484,16 @@ type MethodGroupItemParameter(name: string, canonicalTypeTextForSorting: string, module internal DescriptionListsImpl = let isFunction g ty = - let _, tau = tryDestForallTy g ty - isFunTy g tau + let _, tauTy = tryDestForallTy g ty + isFunTy g tauTy - let printCanonicalizedTypeName g (denv:DisplayEnv) tau = + let printCanonicalizedTypeName g (denv:DisplayEnv) tauTy = // get rid of F# abbreviations and such - let strippedType = stripTyEqnsWrtErasure EraseAll g tau + let strippedTy = stripTyEqnsWrtErasure EraseAll g tauTy // pretend no namespaces are open let denv = denv.SetOpenPaths([]) // now printing will see a .NET-like canonical representation, that is good for sorting overloads into a reasonable order (see bug 94520) - NicePrint.stringOfTy denv strippedType + NicePrint.stringOfTy denv strippedTy let PrettyParamOfRecdField g denv (f: RecdField) = let display = NicePrint.prettyLayoutOfType denv f.FormalType @@ -566,12 +566,12 @@ module internal DescriptionListsImpl = // Remake the params using the prettified versions let prettyParams = - (paramInfo, prettyParamTys, prettyParamTysL) |||> List.map3 (fun (nm, isOptArg, paramPrefix) tau tyL -> + (paramInfo, prettyParamTys, prettyParamTysL) |||> List.map3 (fun (nm, isOptArg, paramPrefix) tauTy tyL -> let display = paramPrefix ^^ tyL let display = toArray display MethodGroupItemParameter( name = nm, - canonicalTypeTextForSorting = printCanonicalizedTypeName g denv tau, + canonicalTypeTextForSorting = printCanonicalizedTypeName g denv tauTy, display = display, isOptional=isOptArg )) @@ -587,11 +587,11 @@ module internal DescriptionListsImpl = // Remake the params using the prettified versions let parameters = (prettyParamTys, prettyParamTysL) - ||> List.map2 (fun tau tyL -> + ||> List.map2 (fun paramTy tyL -> let display = toArray tyL MethodGroupItemParameter( name = "", - canonicalTypeTextForSorting = printCanonicalizedTypeName g denv tau, + canonicalTypeTextForSorting = printCanonicalizedTypeName g denv paramTy, display = display, isOptional=false )) @@ -635,17 +635,18 @@ module internal DescriptionListsImpl = let denv = { SimplerDisplayEnv denv with useColonForReturnType=true} match item.Item with | Item.Value vref -> + let getPrettyParamsOfTypes() = - let tau = vref.TauType - match tryDestFunTy denv.g tau with - | ValueSome(arg, rtau) -> + let vTauTy = vref.TauType + match tryDestFunTy denv.g vTauTy with + | ValueSome(arg, retTy) -> let args = tryDestRefTupleTy denv.g arg - let _prettyTyparInst, prettyParams, prettyRetTyL, _prettyConstraintsL = PrettyParamsOfTypes g denv item.TyparInstantiation args rtau + let _prettyTyparInst, prettyParams, prettyRetTyL, _prettyConstraintsL = PrettyParamsOfTypes g denv item.TyparInstantiation args retTy // FUTURE: prettyTyparInst is the pretty version of the known instantiations of type parameters in the output. It could be returned // for display as part of the method group prettyParams, prettyRetTyL | _ -> - let _prettyTyparInst, prettyTyL = NicePrint.prettyLayoutOfUncurriedSig denv item.TyparInstantiation [] tau + let _prettyTyparInst, prettyTyL = NicePrint.prettyLayoutOfUncurriedSig denv item.TyparInstantiation [] vTauTy [], prettyTyL match vref.ValReprInfo with @@ -675,7 +676,7 @@ module internal DescriptionListsImpl = // Adjust the return type so it only strips the first argument let curriedRetTy = match tryDestFunTy denv.g vref.TauType with - | ValueSome(_, rtau) -> rtau + | ValueSome(_, retTy) -> retTy | _ -> lastRetTy let _prettyTyparInst, prettyFirstCurriedParams, prettyCurriedRetTyL, prettyConstraintsL = PrettyParamsOfParamDatas g denv item.TyparInstantiation firstCurriedParamDatas curriedRetTy @@ -695,8 +696,8 @@ module internal DescriptionListsImpl = | Item.ActivePatternCase(apref) -> let v = apref.ActivePatternVal - let tau = v.TauType - let args, resTy = stripFunTy denv.g tau + let vTauTy = v.TauType + let args, resTy = stripFunTy denv.g vTauTy let apinfo = Option.get (TryGetActivePatternInfo v) let aparity = apinfo.Names.Length @@ -726,7 +727,7 @@ module internal DescriptionListsImpl = [], prettyRetTyL | Item.Event einfo -> - let _prettyTyparInst, prettyRetTyL = NicePrint.prettyLayoutOfUncurriedSig denv item.TyparInstantiation [] (PropTypOfEventInfo infoReader m AccessibleFromSomewhere einfo) + let _prettyTyparInst, prettyRetTyL = NicePrint.prettyLayoutOfUncurriedSig denv item.TyparInstantiation [] (PropTypeOfEventInfo infoReader m AccessibleFromSomewhere einfo) [], prettyRetTyL | Item.Property(_, pinfo :: _) -> @@ -775,11 +776,11 @@ module internal DescriptionListsImpl = let _prettyTyparInst, prettyRetTyL = NicePrint.prettyLayoutOfUncurriedSig denv item.TyparInstantiation [] ty [], prettyRetTyL - | Item.DelegateCtor delty -> - let (SigOfFunctionForDelegate(_, _, _, delFuncTy)) = GetSigOfFunctionForDelegate infoReader delty m AccessibleFromSomewhere + | Item.DelegateCtor delTy -> + let (SigOfFunctionForDelegate(_, _, _, delFuncTy)) = GetSigOfFunctionForDelegate infoReader delTy m AccessibleFromSomewhere // No need to pass more generic type information in here since the instanitations have already been applied - let _prettyTyparInst, prettyParams, prettyRetTyL, _prettyConstraintsL = PrettyParamsOfParamDatas g denv item.TyparInstantiation [ParamData(false, false, false, NotOptional, NoCallerInfo, None, ReflectedArgInfo.None, delFuncTy)] delty + let _prettyTyparInst, prettyParams, prettyRetTyL, _prettyConstraintsL = PrettyParamsOfParamDatas g denv item.TyparInstantiation [ParamData(false, false, false, NotOptional, NoCallerInfo, None, ReflectedArgInfo.None, delFuncTy)] delTy // FUTURE: prettyTyparInst is the pretty version of the known instantiations of type parameters in the output. It could be returned // for display as part of the method group diff --git a/src/Compiler/Service/ServiceNavigation.fs b/src/Compiler/Service/ServiceNavigation.fs index 68b7eb268f9..0751225c890 100755 --- a/src/Compiler/Service/ServiceNavigation.fs +++ b/src/Compiler/Service/ServiceNavigation.fs @@ -121,8 +121,8 @@ module NavigationImpl = |> List.fold (fun st (SynField (_, _, _, _, _, _, _, m)) -> unionRangesChecked m st) range.Zero | SynUnionCaseKind.FullType (ty, _) -> ty.Range - let bodyRange mb decls = - unionRangesChecked (rangeOfDecls decls) mb + let bodyRange mBody decls = + unionRangesChecked (rangeOfDecls decls) mBody /// Get information for implementation file let getNavigationFromImplFile (modules: SynModuleOrNamespace list) = @@ -143,18 +143,18 @@ module NavigationImpl = sprintf "%s_%d_of_%d" name idx total // Create declaration (for the left dropdown) - let createDeclLid (baseName, lid, kind, baseGlyph, m, bodym, nested, enclosingEntityKind, access) = + let createDeclLid (baseName, lid, kind, baseGlyph, m, mBody, nested, enclosingEntityKind, access) = let name = (if baseName <> "" then baseName + "." else "") + textOfLid lid - let item = NavigationItem.Create(name, kind, baseGlyph, m, bodym, false, enclosingEntityKind, false, access) + let item = NavigationItem.Create(name, kind, baseGlyph, m, mBody, false, enclosingEntityKind, false, access) item, addItemName name, nested - let createDecl (baseName, id: Ident, kind, baseGlyph, m, bodym, nested, enclosingEntityKind, isAbstract, access) = + let createDecl (baseName, id: Ident, kind, baseGlyph, m, mBody, nested, enclosingEntityKind, isAbstract, access) = let name = (if baseName <> "" then baseName + "." else "") + id.idText - let item = NavigationItem.Create(name, kind, baseGlyph, m, bodym, false, enclosingEntityKind, isAbstract, access) + let item = NavigationItem.Create(name, kind, baseGlyph, m, mBody, false, enclosingEntityKind, isAbstract, access) item, addItemName name, nested - let createTypeDecl (baseName, lid, baseGlyph, m, bodym, nested, enclosingEntityKind, access) = - createDeclLid (baseName, lid, NavigationItemKind.Type, baseGlyph, m, bodym, nested, enclosingEntityKind, access) + let createTypeDecl (baseName, lid, baseGlyph, m, mBody, nested, enclosingEntityKind, access) = + createDeclLid (baseName, lid, NavigationItemKind.Type, baseGlyph, m, mBody, nested, enclosingEntityKind, access) // Create member-kind-of-thing for the right dropdown let createMemberLid (lid, kind, baseGlyph, m, enclosingEntityKind, isAbstract, access) = @@ -226,10 +226,10 @@ module NavigationImpl = let rec processExnDefnRepr baseName nested synExnRepr = let (SynExceptionDefnRepr (_, ucase, _, _, access, m)) = synExnRepr let (SynUnionCase (ident = SynIdent (id, _); caseType = fldspec)) = ucase - let bodym = fldspecRange fldspec + let mBody = fldspecRange fldspec [ - createDecl (baseName, id, NavigationItemKind.Exception, FSharpGlyph.Exception, m, bodym, nested, NavigationEntityKind.Exception, false, access) + createDecl (baseName, id, NavigationItemKind.Exception, FSharpGlyph.Exception, m, mBody, nested, NavigationEntityKind.Exception, false, access) ] // Process a class declaration or F# type declaration @@ -247,35 +247,35 @@ module NavigationImpl = match repr with | SynTypeDefnRepr.Exception repr -> processExnDefnRepr baseName [] repr - | SynTypeDefnRepr.ObjectModel (_, membDefns, mb) -> + | SynTypeDefnRepr.ObjectModel (_, membDefns, mBody) -> // F# class declaration let members = processMembers membDefns NavigationEntityKind.Class |> snd let nested = members @ topMembers - let bodym = bodyRange mb nested + let mBody = bodyRange mBody nested [ - createTypeDecl (baseName, lid, FSharpGlyph.Class, m, bodym, nested, NavigationEntityKind.Class, access) + createTypeDecl (baseName, lid, FSharpGlyph.Class, m, mBody, nested, NavigationEntityKind.Class, access) ] | SynTypeDefnRepr.Simple (simple, _) -> // F# type declaration match simple with - | SynTypeDefnSimpleRepr.Union (_, cases, mb) -> + | SynTypeDefnSimpleRepr.Union (_, cases, mBody) -> let cases = [ for SynUnionCase (ident = SynIdent (id, _); caseType = fldspec) in cases -> - let bodym = unionRanges (fldspecRange fldspec) id.idRange - createMember (id, NavigationItemKind.Other, FSharpGlyph.Struct, bodym, NavigationEntityKind.Union, false, access) + let mBody = unionRanges (fldspecRange fldspec) id.idRange + createMember (id, NavigationItemKind.Other, FSharpGlyph.Struct, mBody, NavigationEntityKind.Union, false, access) ] let nested = cases @ topMembers - let bodym = bodyRange mb nested + let mBody = bodyRange mBody nested [ - createTypeDecl (baseName, lid, FSharpGlyph.Union, m, bodym, nested, NavigationEntityKind.Union, access) + createTypeDecl (baseName, lid, FSharpGlyph.Union, m, mBody, nested, NavigationEntityKind.Union, access) ] - | SynTypeDefnSimpleRepr.Enum (cases, mb) -> + | SynTypeDefnSimpleRepr.Enum (cases, mBody) -> let cases = [ for SynEnumCase (ident = SynIdent (id, _); range = m) in cases -> @@ -283,13 +283,13 @@ module NavigationImpl = ] let nested = cases @ topMembers - let bodym = bodyRange mb nested + let mBody = bodyRange mBody nested [ - createTypeDecl (baseName, lid, FSharpGlyph.Enum, m, bodym, nested, NavigationEntityKind.Enum, access) + createTypeDecl (baseName, lid, FSharpGlyph.Enum, m, mBody, nested, NavigationEntityKind.Enum, access) ] - | SynTypeDefnSimpleRepr.Record (_, fields, mb) -> + | SynTypeDefnSimpleRepr.Record (_, fields, mBody) -> let fields = [ for SynField (_, _, id, _, _, _, _, m) in fields do @@ -299,17 +299,17 @@ module NavigationImpl = ] let nested = fields @ topMembers - let bodym = bodyRange mb nested + let mBody = bodyRange mBody nested [ - createTypeDecl (baseName, lid, FSharpGlyph.Type, m, bodym, nested, NavigationEntityKind.Record, access) + createTypeDecl (baseName, lid, FSharpGlyph.Type, m, mBody, nested, NavigationEntityKind.Record, access) ] - | SynTypeDefnSimpleRepr.TypeAbbrev (_, _, mb) -> - let bodym = bodyRange mb topMembers + | SynTypeDefnSimpleRepr.TypeAbbrev (_, _, mBody) -> + let mBody = bodyRange mBody topMembers [ - createTypeDecl (baseName, lid, FSharpGlyph.Typedef, m, bodym, topMembers, NavigationEntityKind.Class, access) + createTypeDecl (baseName, lid, FSharpGlyph.Typedef, m, mBody, topMembers, NavigationEntityKind.Class, access) ] //| SynTypeDefnSimpleRepr.General of TyconKind * (SynType * Range * ident option) list * (valSpfn * MemberFlags) list * fieldDecls * bool * bool * Range @@ -371,8 +371,8 @@ module NavigationImpl = for decl in decls do match decl with | SynModuleDecl.ModuleAbbrev (id, lid, m) -> - let bodym = rangeOfLid lid - createDecl (baseName, id, NavigationItemKind.Module, FSharpGlyph.Module, m, bodym, [], NavigationEntityKind.Namespace, false, None) + let mBody = rangeOfLid lid + createDecl (baseName, id, NavigationItemKind.Module, FSharpGlyph.Module, m, mBody, [], NavigationEntityKind.Namespace, false, None) | SynModuleDecl.NestedModule (moduleInfo = SynComponentInfo (longId = lid; accessibility = access); decls = decls; range = m) -> // Find let bindings (for the right dropdown) @@ -380,8 +380,8 @@ module NavigationImpl = let newBaseName = (if (baseName = "") then "" else baseName + ".") + (textOfLid lid) let other = processNavigationTopLevelDeclarations (newBaseName, decls) - let bodym = unionRangesChecked (rangeOfDecls nested) (moduleRange (rangeOfLid lid) other) - createDeclLid (baseName, lid, NavigationItemKind.Module, FSharpGlyph.Module, m, bodym, nested, NavigationEntityKind.Module, access) + let mBody = unionRangesChecked (rangeOfDecls nested) (moduleRange (rangeOfLid lid) other) + createDeclLid (baseName, lid, NavigationItemKind.Module, FSharpGlyph.Module, m, mBody, nested, NavigationEntityKind.Module, access) // Get nested modules and types (for the left dropdown) yield! other @@ -414,11 +414,11 @@ module NavigationImpl = else NavigationItemKind.Namespace - let bodym = unionRangesChecked (rangeOfDecls nested) (moduleRange (rangeOfLid id) other) + let mBody = unionRangesChecked (rangeOfDecls nested) (moduleRange (rangeOfLid id) other) let nm = textOfLid id let item = - NavigationItem.Create(nm, kind, FSharpGlyph.Module, m, bodym, singleTopLevel, NavigationEntityKind.Module, false, access) + NavigationItem.Create(nm, kind, FSharpGlyph.Module, m, mBody, singleTopLevel, NavigationEntityKind.Module, false, access) let decl = (item, addItemName (nm), nested) decl @@ -462,17 +462,17 @@ module NavigationImpl = sprintf "%s_%d_of_%d" name idx total // Create declaration (for the left dropdown) - let createDeclLid (baseName, lid, kind, baseGlyph, m, bodym, nested, enclosingEntityKind, access) = + let createDeclLid (baseName, lid, kind, baseGlyph, m, mBody, nested, enclosingEntityKind, access) = let name = (if baseName <> "" then baseName + "." else "") + (textOfLid lid) - let item = NavigationItem.Create(name, kind, baseGlyph, m, bodym, false, enclosingEntityKind, false, access) + let item = NavigationItem.Create(name, kind, baseGlyph, m, mBody, false, enclosingEntityKind, false, access) item, addItemName name, nested - let createTypeDecl (baseName, lid, baseGlyph, m, bodym, nested, enclosingEntityKind, access) = - createDeclLid (baseName, lid, NavigationItemKind.Type, baseGlyph, m, bodym, nested, enclosingEntityKind, access) + let createTypeDecl (baseName, lid, baseGlyph, m, mBody, nested, enclosingEntityKind, access) = + createDeclLid (baseName, lid, NavigationItemKind.Type, baseGlyph, m, mBody, nested, enclosingEntityKind, access) - let createDecl (baseName, id: Ident, kind, baseGlyph, m, bodym, nested, enclosingEntityKind, isAbstract, access) = + let createDecl (baseName, id: Ident, kind, baseGlyph, m, mBody, nested, enclosingEntityKind, isAbstract, access) = let name = (if baseName <> "" then baseName + "." else "") + id.idText - let item = NavigationItem.Create(name, kind, baseGlyph, m, bodym, false, enclosingEntityKind, isAbstract, access) + let item = NavigationItem.Create(name, kind, baseGlyph, m, mBody, false, enclosingEntityKind, isAbstract, access) item, addItemName name, nested let createMember (id: Ident, kind, baseGlyph, m, enclosingEntityKind, isAbstract, access) = @@ -481,10 +481,10 @@ module NavigationImpl = let rec processExnRepr baseName nested inp = let (SynExceptionDefnRepr (_, SynUnionCase (ident = SynIdent (id, _); caseType = fldspec), _, _, access, m)) = inp - let bodym = fldspecRange fldspec + let mBody = fldspecRange fldspec [ - createDecl (baseName, id, NavigationItemKind.Exception, FSharpGlyph.Exception, m, bodym, nested, NavigationEntityKind.Exception, false, access) + createDecl (baseName, id, NavigationItemKind.Exception, FSharpGlyph.Exception, m, mBody, nested, NavigationEntityKind.Exception, false, access) ] and processExnSig baseName inp = @@ -501,16 +501,16 @@ module NavigationImpl = [ match repr with | SynTypeDefnSigRepr.Exception repr -> yield! processExnRepr baseName [] repr - | SynTypeDefnSigRepr.ObjectModel (_, membDefns, mb) -> + | SynTypeDefnSigRepr.ObjectModel (_, membDefns, mBody) -> // F# class declaration let members = processSigMembers membDefns let nested = members @ topMembers - let bodym = bodyRange mb nested - createTypeDecl (baseName, lid, FSharpGlyph.Class, m, bodym, nested, NavigationEntityKind.Class, access) + let mBody = bodyRange mBody nested + createTypeDecl (baseName, lid, FSharpGlyph.Class, m, mBody, nested, NavigationEntityKind.Class, access) | SynTypeDefnSigRepr.Simple (simple, _) -> // F# type declaration match simple with - | SynTypeDefnSimpleRepr.Union (_, cases, mb) -> + | SynTypeDefnSimpleRepr.Union (_, cases, mBody) -> let cases = [ for SynUnionCase (ident = SynIdent (id, _); caseType = fldspec) in cases -> @@ -519,9 +519,9 @@ module NavigationImpl = ] let nested = cases @ topMembers - let bodym = bodyRange mb nested - createTypeDecl (baseName, lid, FSharpGlyph.Union, m, bodym, nested, NavigationEntityKind.Union, access) - | SynTypeDefnSimpleRepr.Enum (cases, mb) -> + let mBody = bodyRange mBody nested + createTypeDecl (baseName, lid, FSharpGlyph.Union, m, mBody, nested, NavigationEntityKind.Union, access) + | SynTypeDefnSimpleRepr.Enum (cases, mBody) -> let cases = [ for SynEnumCase (ident = SynIdent (id, _); range = m) in cases -> @@ -529,9 +529,9 @@ module NavigationImpl = ] let nested = cases @ topMembers - let bodym = bodyRange mb nested - createTypeDecl (baseName, lid, FSharpGlyph.Enum, m, bodym, nested, NavigationEntityKind.Enum, access) - | SynTypeDefnSimpleRepr.Record (_, fields, mb) -> + let mBody = bodyRange mBody nested + createTypeDecl (baseName, lid, FSharpGlyph.Enum, m, mBody, nested, NavigationEntityKind.Enum, access) + | SynTypeDefnSimpleRepr.Record (_, fields, mBody) -> let fields = [ for SynField (_, _, id, _, _, _, _, m) in fields do @@ -541,11 +541,11 @@ module NavigationImpl = ] let nested = fields @ topMembers - let bodym = bodyRange mb nested - createTypeDecl (baseName, lid, FSharpGlyph.Type, m, bodym, nested, NavigationEntityKind.Record, access) - | SynTypeDefnSimpleRepr.TypeAbbrev (_, _, mb) -> - let bodym = bodyRange mb topMembers - createTypeDecl (baseName, lid, FSharpGlyph.Typedef, m, bodym, topMembers, NavigationEntityKind.Class, access) + let mBody = bodyRange mBody nested + createTypeDecl (baseName, lid, FSharpGlyph.Type, m, mBody, nested, NavigationEntityKind.Record, access) + | SynTypeDefnSimpleRepr.TypeAbbrev (_, _, mBody) -> + let mBody = bodyRange mBody topMembers + createTypeDecl (baseName, lid, FSharpGlyph.Typedef, m, mBody, topMembers, NavigationEntityKind.Class, access) //| SynTypeDefnSimpleRepr.General of TyconKind * (SynType * range * ident option) list * (valSpfn * MemberFlags) list * fieldDecls * bool * bool * range //| SynTypeDefnSimpleRepr.LibraryOnlyILAssembly of ILType * range @@ -581,8 +581,8 @@ module NavigationImpl = for decl in decls do match decl with | SynModuleSigDecl.ModuleAbbrev (id, lid, m) -> - let bodym = rangeOfLid lid - createDecl (baseName, id, NavigationItemKind.Module, FSharpGlyph.Module, m, bodym, [], NavigationEntityKind.Module, false, None) + let mBody = rangeOfLid lid + createDecl (baseName, id, NavigationItemKind.Module, FSharpGlyph.Module, m, mBody, [], NavigationEntityKind.Module, false, None) | SynModuleSigDecl.NestedModule (moduleInfo = SynComponentInfo (longId = lid; accessibility = access); moduleDecls = decls; range = m) -> // Find let bindings (for the right dropdown) @@ -591,8 +591,8 @@ module NavigationImpl = let other = processNavigationTopLevelSigDeclarations (newBaseName, decls) // Get nested modules and types (for the left dropdown) - let bodym = unionRangesChecked (rangeOfDecls nested) (moduleRange (rangeOfLid lid) other) - createDeclLid (baseName, lid, NavigationItemKind.Module, FSharpGlyph.Module, m, bodym, nested, NavigationEntityKind.Module, access) + let mBody = unionRangesChecked (rangeOfDecls nested) (moduleRange (rangeOfLid lid) other) + createDeclLid (baseName, lid, NavigationItemKind.Module, FSharpGlyph.Module, m, mBody, nested, NavigationEntityKind.Module, access) yield! other | SynModuleSigDecl.Types (tydefs, _) -> @@ -623,10 +623,10 @@ module NavigationImpl = else NavigationItemKind.Namespace - let bodym = unionRangesChecked (rangeOfDecls nested) (moduleRange (rangeOfLid id) other) + let mBody = unionRangesChecked (rangeOfDecls nested) (moduleRange (rangeOfLid id) other) let item = - NavigationItem.Create(textOfLid id, kind, FSharpGlyph.Module, m, bodym, singleTopLevel, NavigationEntityKind.Module, false, access) + NavigationItem.Create(textOfLid id, kind, FSharpGlyph.Module, m, mBody, singleTopLevel, NavigationEntityKind.Module, false, access) let decl = (item, addItemName (textOfLid id), nested) decl diff --git a/src/Compiler/Service/ServiceParamInfoLocations.fs b/src/Compiler/Service/ServiceParamInfoLocations.fs index ff34dd392d4..b757120b628 100755 --- a/src/Compiler/Service/ServiceParamInfoLocations.fs +++ b/src/Compiler/Service/ServiceParamInfoLocations.fs @@ -73,8 +73,8 @@ module internal ParameterLocationsImpl = match synExpr with | SynExpr.Ident id -> Some([ id.idText ], id.idRange) | SynExpr.LongIdent (_, SynLongIdent ([ id ], [], [ Some _ ]), _, _) -> Some([ id.idText ], id.idRange) - | SynExpr.LongIdent (_, SynLongIdent (lid, _, _), _, lidRange) - | SynExpr.DotGet (_, _, SynLongIdent (lid, _, _), lidRange) -> Some(pathOfLid lid, lidRange) + | SynExpr.LongIdent (_, SynLongIdent (lid, _, _), _, mLongId) + | SynExpr.DotGet (_, _, SynLongIdent (lid, _, _), mLongId) -> Some(pathOfLid lid, mLongId) | SynExpr.TypeApp (synExpr, _, _synTypeList, _commas, _, _, _range) -> digOutIdentFromFuncExpr synExpr | SynExpr.Paren (expr = expr) -> digOutIdentFromFuncExpr expr | _ -> None @@ -213,14 +213,14 @@ module internal ParameterLocationsImpl = let (|StaticParameters|_|) pos (StripParenTypes synType) = match synType with | SynType.App (StripParenTypes (SynType.LongIdent (SynLongIdent (lid, _, _) as lidwd)), - Some (openm), + Some mLess, args, commas, - closemOpt, + mGreaterOpt, _pf, wholem) -> let lidm = lidwd.Range - let betweenTheBrackets = mkRange wholem.FileName openm.Start wholem.End + let betweenTheBrackets = mkRange wholem.FileName mLess.Start wholem.End if SyntaxTraversal.rangeContainsPosEdgesExclusive betweenTheBrackets pos @@ -232,10 +232,10 @@ module internal ParameterLocationsImpl = ParameterLocations( pathOfLid lid, lidm, - openm.Start, + mLess.Start, [], commasAndCloseParen, - closemOpt.IsSome, + mGreaterOpt.IsSome, args |> List.map digOutIdentFromStaticArg ) ) @@ -281,7 +281,7 @@ module internal ParameterLocationsImpl = // EXPR< = error recovery of a form of half-written TypeApp | SynExpr.App (_, _, - SynExpr.App (_, true, SynExpr.LongIdent(longDotId = SynLongIdent(id = [ op ])), synExpr, openm), + SynExpr.App (_, true, SynExpr.LongIdent(longDotId = SynLongIdent(id = [ op ])), synExpr, mLess), SynExpr.ArbitraryAfterError _, wholem) when op.idText = "op_LessThan" -> // Look in the function expression @@ -290,13 +290,13 @@ module internal ParameterLocationsImpl = match fResult with | Some _ -> fResult | _ -> - let typeArgsm = mkRange openm.FileName openm.Start wholem.End + let typeArgsm = mkRange mLess.FileName mLess.Start wholem.End if SyntaxTraversal.rangeContainsPosEdgesExclusive typeArgsm pos then // We found it, dig out ident match digOutIdentFromFuncExpr synExpr with - | Some (lid, lidRange) -> - Some(ParameterLocations(lid, lidRange, op.idRange.Start, [], [ wholem.End ], false, [])) + | Some (lid, mLongId) -> + Some(ParameterLocations(lid, mLongId, op.idRange.Start, [], [ wholem.End ], false, [])) | None -> None else None @@ -316,8 +316,8 @@ module internal ParameterLocationsImpl = | Found (parenLoc, argRanges, commasAndCloseParen, isThereACloseParen), _ -> // We found it, dig out ident match digOutIdentFromFuncExpr synExpr with - | Some (lid, lidRange) -> - assert (isInfix = (posLt parenLoc lidRange.End)) + | Some (lid, mLongId) -> + assert (isInfix = (posLt parenLoc mLongId.End)) if isInfix then // This seems to be an infix operator, since the start of the argument is a position earlier than the end of the long-id being applied to it. @@ -327,7 +327,7 @@ module internal ParameterLocationsImpl = Some( ParameterLocations( lid, - lidRange, + mLongId, parenLoc, argRanges, commasAndCloseParen |> List.map fst, @@ -340,11 +340,11 @@ module internal ParameterLocationsImpl = | _ -> traverseSynExpr synExpr2 // ID and error recovery of these - | SynExpr.TypeApp (synExpr, openm, tyArgs, commas, closemOpt, _, wholem) -> + | SynExpr.TypeApp (synExpr, mLess, tyArgs, commas, mGreaterOpt, _, wholem) -> match traverseSynExpr synExpr with | Some _ as r -> r | None -> - let typeArgsm = mkRange openm.FileName openm.Start wholem.End + let typeArgsm = mkRange mLess.FileName mLess.Start wholem.End if SyntaxTraversal.rangeContainsPosEdgesExclusive typeArgsm pos @@ -364,10 +364,10 @@ module internal ParameterLocationsImpl = ParameterLocations( [ "dummy" ], synExpr.Range, - openm.Start, + mLess.Start, argRanges, commasAndCloseParen, - closemOpt.IsSome, + mGreaterOpt.IsSome, tyArgs |> List.map digOutIdentFromStaticArg ) diff --git a/src/Compiler/Service/ServiceParsedInputOps.fs b/src/Compiler/Service/ServiceParsedInputOps.fs index 757cd90a264..a7ffb760e5a 100644 --- a/src/Compiler/Service/ServiceParsedInputOps.fs +++ b/src/Compiler/Service/ServiceParsedInputOps.fs @@ -476,8 +476,8 @@ module ParsedInput = ] |> pick expr - | SynExpr.DotGet (exprLeft, dotm, lidwd, _m) -> - let afterDotBeforeLid = mkRange dotm.FileName dotm.End lidwd.Range.Start + | SynExpr.DotGet (exprLeft, mDot, lidwd, _m) -> + let afterDotBeforeLid = mkRange mDot.FileName mDot.End lidwd.Range.Start [ dive exprLeft exprLeft.Range traverseSynExpr diff --git a/src/Compiler/Service/ServiceStructure.fs b/src/Compiler/Service/ServiceStructure.fs index 995e4e4d3e9..cbc625f709b 100644 --- a/src/Compiler/Service/ServiceStructure.fs +++ b/src/Compiler/Service/ServiceStructure.fs @@ -364,30 +364,30 @@ module Structure = members = ms extraImpls = extraImpls newExprRange = newRange - range = wholeRange) -> + range = mWhole) -> let bindings = unionBindingAndMembers bindings ms match argOpt with | Some (args, _) -> - let collapse = Range.endToEnd args.Range wholeRange - rcheck Scope.ObjExpr Collapse.Below wholeRange collapse + let collapse = Range.endToEnd args.Range mWhole + rcheck Scope.ObjExpr Collapse.Below mWhole collapse | None -> - let collapse = Range.endToEnd newRange wholeRange - rcheck Scope.ObjExpr Collapse.Below wholeRange collapse + let collapse = Range.endToEnd newRange mWhole + rcheck Scope.ObjExpr Collapse.Below mWhole collapse parseBindings bindings parseExprInterfaces extraImpls - | SynExpr.TryWith (e, matchClauses, wholeRange, tryPoint, withPoint, _trivia) -> + | SynExpr.TryWith (e, matchClauses, mWhole, tryPoint, withPoint, _trivia) -> match tryPoint, withPoint with | DebugPointAtTry.Yes tryRange, DebugPointAtWith.Yes withRange -> - let fullrange = Range.startToEnd tryRange wholeRange - let collapse = Range.endToEnd tryRange wholeRange + let mFull = Range.startToEnd tryRange mWhole + let collapse = Range.endToEnd tryRange mWhole let collapseTry = Range.endToStart tryRange withRange let fullrangeTry = Range.startToStart tryRange withRange - let collapseWith = Range.endToEnd withRange wholeRange - let fullrangeWith = Range.startToEnd withRange wholeRange - rcheck Scope.TryWith Collapse.Below fullrange collapse + let collapseWith = Range.endToEnd withRange mWhole + let fullrangeWith = Range.startToEnd withRange mWhole + rcheck Scope.TryWith Collapse.Below mFull collapse rcheck Scope.TryInTryWith Collapse.Below fullrangeTry collapseTry rcheck Scope.WithInTryWith Collapse.Below fullrangeWith collapseWith | _ -> () @@ -399,10 +399,10 @@ module Structure = match tryPoint, finallyPoint with | DebugPointAtTry.Yes tryRange, DebugPointAtFinally.Yes finallyRange -> let collapse = Range.endToEnd tryRange finallyExpr.Range - let fullrange = Range.startToEnd tryRange finallyExpr.Range + let mFull = Range.startToEnd tryRange finallyExpr.Range let collapseFinally = Range.endToEnd finallyRange r let fullrangeFinally = Range.startToEnd finallyRange r - rcheck Scope.TryFinally Collapse.Below fullrange collapse + rcheck Scope.TryFinally Collapse.Below mFull collapse rcheck Scope.FinallyInTryFinally Collapse.Below fullrangeFinally collapseFinally | _ -> () @@ -418,9 +418,9 @@ module Structure = match spIfToThen with | DebugPointAtBinding.Yes rt -> // Outline the entire IfThenElse - let fullrange = Range.startToEnd rt r + let mFull = Range.startToEnd rt r let collapse = Range.endToEnd ifExpr.Range r - rcheck Scope.IfThenElse Collapse.Below fullrange collapse + rcheck Scope.IfThenElse Collapse.Below mFull collapse // Outline the `then` scope let thenRange = Range.endToEnd (Range.modEnd -4 trivia.IfToThenRange) thenExpr.Range let thenCollapse = Range.endToEnd trivia.IfToThenRange thenExpr.Range @@ -653,24 +653,24 @@ module Structure = | _ -> () and parseTypeDefn typeDefn = - let (SynTypeDefn (typeInfo = typeInfo; typeRepr = objectModel; members = members; range = fullrange)) = + let (SynTypeDefn (typeInfo = typeInfo; typeRepr = objectModel; members = members; range = mFull)) = typeDefn let (SynComponentInfo (typeParams = TyparDecls typeArgs; range = r)) = typeInfo let typeArgsRange = rangeOfTypeArgsElse r typeArgs - let collapse = Range.endToEnd (Range.modEnd 1 typeArgsRange) fullrange + let collapse = Range.endToEnd (Range.modEnd 1 typeArgsRange) mFull match objectModel with | SynTypeDefnRepr.ObjectModel (defnKind, objMembers, r) -> match defnKind with - | SynTypeDefnKind.Augmentation _ -> rcheck Scope.TypeExtension Collapse.Below fullrange collapse - | _ -> rcheck Scope.Type Collapse.Below fullrange collapse + | SynTypeDefnKind.Augmentation _ -> rcheck Scope.TypeExtension Collapse.Below mFull collapse + | _ -> rcheck Scope.Type Collapse.Below mFull collapse List.iter (parseSynMemberDefn r) objMembers // visit the members of a type extension List.iter (parseSynMemberDefn r) members | SynTypeDefnRepr.Simple (simpleRepr, r) -> - rcheck Scope.Type Collapse.Below fullrange collapse + rcheck Scope.Type Collapse.Below mFull collapse parseSimpleRepr simpleRepr List.iter (parseSynMemberDefn r) members | SynTypeDefnRepr.Exception _ -> () @@ -774,12 +774,12 @@ module Structure = let parseModuleOrNamespace (SynModuleOrNamespace (longId, _, kind, decls, _, attribs, _, r, _)) = parseAttributes attribs let idRange = longIdentRange longId - let fullrange = Range.startToEnd idRange r + let mFull = Range.startToEnd idRange r let collapse = Range.endToEnd idRange r // do not return range for top level implicit module in scripts if kind = SynModuleOrNamespaceKind.NamedModule then - rcheck Scope.Module Collapse.Below fullrange collapse + rcheck Scope.Module Collapse.Below mFull collapse collectHashDirectives decls collectOpens decls @@ -893,9 +893,9 @@ module Structure = | SynMemberSig.Member (valSigs, _, r) -> let collapse = Range.endToEnd valSigs.RangeOfId r rcheck Scope.Member Collapse.Below r collapse - | SynMemberSig.ValField (SynField (attrs, _, _, _, _, _, _, fr), fullrange) -> - let collapse = Range.endToEnd fr fullrange - rcheck Scope.Val Collapse.Below fullrange collapse + | SynMemberSig.ValField (SynField (attrs, _, _, _, _, _, _, fr), mFull) -> + let collapse = Range.endToEnd fr mFull + rcheck Scope.Val Collapse.Below mFull collapse parseAttributes attrs | SynMemberSig.Interface (tp, r) -> rcheck Scope.Interface Collapse.Below r (Range.endToEnd tp.Range r) | SynMemberSig.NestedType (typeDefSig, _r) -> parseTypeDefnSig typeDefSig @@ -913,8 +913,8 @@ module Structure = let typeArgsRange = rangeOfTypeArgsElse r typeArgs let rangeEnd = lastMemberSigRangeElse r memberSigs let collapse = Range.endToEnd (Range.modEnd 1 typeArgsRange) rangeEnd - let fullrange = Range.startToEnd (longIdentRange longId) rangeEnd - fullrange, collapse + let mFull = Range.startToEnd (longIdentRange longId) rangeEnd + mFull, collapse List.iter parseSynMemberDefnSig memberSigs @@ -922,23 +922,23 @@ module Structure = // matches against a type declaration with <'T, ...> and (args, ...) | SynTypeDefnSigRepr.ObjectModel (SynTypeDefnKind.Unspecified, objMembers, _) -> List.iter parseSynMemberDefnSig objMembers - let fullrange, collapse = makeRanges objMembers - rcheck Scope.Type Collapse.Below fullrange collapse + let mFull, collapse = makeRanges objMembers + rcheck Scope.Type Collapse.Below mFull collapse | SynTypeDefnSigRepr.ObjectModel (kind = SynTypeDefnKind.Augmentation _; memberSigs = objMembers) -> - let fullrange, collapse = makeRanges objMembers - rcheck Scope.TypeExtension Collapse.Below fullrange collapse + let mFull, collapse = makeRanges objMembers + rcheck Scope.TypeExtension Collapse.Below mFull collapse List.iter parseSynMemberDefnSig objMembers | SynTypeDefnSigRepr.ObjectModel (_, objMembers, _) -> - let fullrange, collapse = makeRanges objMembers - rcheck Scope.Type Collapse.Below fullrange collapse + let mFull, collapse = makeRanges objMembers + rcheck Scope.Type Collapse.Below mFull collapse List.iter parseSynMemberDefnSig objMembers // visit the members of a type extension | SynTypeDefnSigRepr.Simple (simpleRepr, _) -> - let fullrange, collapse = makeRanges memberSigs - rcheck Scope.Type Collapse.Below fullrange collapse + let mFull, collapse = makeRanges memberSigs + rcheck Scope.Type Collapse.Below mFull collapse parseSimpleRepr simpleRepr | SynTypeDefnSigRepr.Exception _ -> () @@ -1021,8 +1021,8 @@ module Structure = let rangeEnd = lastModuleSigDeclRangeElse moduleRange decls // Outline the full scope of the module let collapse = Range.endToEnd cmpRange rangeEnd - let fullrange = Range.startToEnd moduleRange rangeEnd - rcheck Scope.Module Collapse.Below fullrange collapse + let mFull = Range.startToEnd moduleRange rangeEnd + rcheck Scope.Module Collapse.Below mFull collapse // A module's component info stores the ranges of its attributes parseAttributes attrs collectSigOpens decls @@ -1034,11 +1034,11 @@ module Structure = parseAttributes attribs let rangeEnd = lastModuleSigDeclRangeElse r decls let idrange = longIdentRange longId - let fullrange = Range.startToEnd idrange rangeEnd + let mFull = Range.startToEnd idrange rangeEnd let collapse = Range.endToEnd idrange rangeEnd if kind.IsModule then - rcheck Scope.Module Collapse.Below fullrange collapse + rcheck Scope.Module Collapse.Below mFull collapse collectSigHashDirectives decls collectSigOpens decls diff --git a/src/Compiler/Symbols/Exprs.fs b/src/Compiler/Symbols/Exprs.fs index 24ffc3cb042..0de02d99948 100644 --- a/src/Compiler/Symbols/Exprs.fs +++ b/src/Compiler/Symbols/Exprs.fs @@ -348,12 +348,12 @@ module FSharpExprConvert = | TOp.UnionCaseFieldGetAddr (uref, n, _), [arg], _ -> mkUnionCaseFieldGetProvenViaExprAddr (exprOfExprAddr cenv arg, uref, tyargs, n, m) | TOp.ILAsm ([ I_ldflda fspec ], retTypes), [arg], _ -> mkAsmExpr ([ mkNormalLdfld fspec ], tyargs, [exprOfExprAddr cenv arg], retTypes, m) | TOp.ILAsm ([ I_ldsflda fspec ], retTypes), _, _ -> mkAsmExpr ([ mkNormalLdsfld fspec ], tyargs, args, retTypes, m) - | TOp.ILAsm ([ I_ldelema(_ro, _isNativePtr, shape, _tyarg) ], _), arr :: idxs, [elemty] -> + | TOp.ILAsm ([ I_ldelema(_ro, _isNativePtr, shape, _tyarg) ], _), arr :: idxs, [elemTy] -> match shape.Rank, idxs with - | 1, [idx1] -> mkCallArrayGet g m elemty arr idx1 - | 2, [idx1; idx2] -> mkCallArray2DGet g m elemty arr idx1 idx2 - | 3, [idx1; idx2; idx3] -> mkCallArray3DGet g m elemty arr idx1 idx2 idx3 - | 4, [idx1; idx2; idx3; idx4] -> mkCallArray4DGet g m elemty arr idx1 idx2 idx3 idx4 + | 1, [idx1] -> mkCallArrayGet g m elemTy arr idx1 + | 2, [idx1; idx2] -> mkCallArray2DGet g m elemTy arr idx1 idx2 + | 3, [idx1; idx2; idx3] -> mkCallArray3DGet g m elemTy arr idx1 idx2 idx3 + | 4, [idx1; idx2; idx3; idx4] -> mkCallArray4DGet g m elemTy arr idx1 idx2 idx3 idx4 | _ -> expr | _ -> expr | _ -> expr @@ -618,7 +618,7 @@ module FSharpExprConvert = let bodyR = ConvExpr cenv env body FSharpObjectExprOverride(sgn, tpsR, vslR, bodyR) ] let overridesR = ConvertMethods overrides - let iimplsR = List.map (fun (ity, impls) -> ConvType cenv ity, ConvertMethods impls) iimpls + let iimplsR = iimpls |> List.map (fun (intfTy, impls) -> ConvType cenv intfTy, ConvertMethods impls) E.ObjectExpr(ConvType cenv ty, basecallR, overridesR, iimplsR) @@ -702,8 +702,8 @@ module FSharpExprConvert = let argR = ConvExpr cenv env arg E.ILFieldSet(None, typR, fspec.Name, argR) - | TOp.ILAsm ([ ], [tty]), _, [arg] -> - match tty with + | TOp.ILAsm ([ ], [tgtTy]), _, [arg] -> + match tgtTy with | TTypeConvOp cenv convOp -> let ty = tyOfExpr g arg let op = convOp g m ty arg @@ -992,7 +992,7 @@ module FSharpExprConvert = let parent = ILTypeRef.Create(e.Scope, e.Enclosing.Tail, e.Enclosing.Head) Import.ImportILTypeRef cenv.amap m parent, Some e.Name - let enclosingType = generalizedTyconRef g tcref + let enclosingTy = generalizedTyconRef g tcref let makeCall minfo = ConvObjectModelCallLinear cenv env (isNewObj, minfo, enclTypeArgs, methTypeArgs, [], callArgs) id @@ -1000,7 +1000,7 @@ module FSharpExprConvert = let makeFSCall isMember (vr: ValRef) = let memOrVal = if isMember then - let minfo = MethInfo.FSMeth(g, enclosingType, vr, None) + let minfo = MethInfo.FSMeth(g, enclosingTy, vr, None) FSharpMemberOrFunctionOrValue(cenv, minfo) else FSharpMemberOrFunctionOrValue(cenv, vr) @@ -1117,7 +1117,7 @@ module FSharpExprConvert = if tcref.IsILTycon then try let mdef = resolveILMethodRefWithRescope unscopeILType tcref.ILTyconRawMetadata ilMethRef - let minfo = MethInfo.CreateILMeth(cenv.amap, m, enclosingType, mdef) + let minfo = MethInfo.CreateILMeth(cenv.amap, m, enclosingTy, mdef) FSharpMemberOrFunctionOrValue(cenv, minfo) |> makeCall |> Some with _ -> None @@ -1155,12 +1155,12 @@ module FSharpExprConvert = let argTys = [ ilMethRef.ArgTypes |> List.map (ImportILTypeFromMetadata cenv.amap m scoref tinst1 tinst2) ] let retTy = match ImportReturnTypeFromMetadata cenv.amap m ilMethRef.ReturnType (fun _ -> emptyILCustomAttrs) scoref tinst1 tinst2 with - | None -> if isCtor then enclosingType else g.unit_ty + | None -> if isCtor then enclosingTy else g.unit_ty | Some ty -> ty let linkageType = let ty = mkIteratedFunTy g (List.map (mkRefTupledTy g) argTys) retTy - let ty = if isStatic then ty else mkFunTy g enclosingType ty + let ty = if isStatic then ty else mkFunTy g enclosingTy ty mkForallTyIfNeeded (typars1 @ typars2) ty let argCount = List.sum (List.map List.length argTys) + (if isStatic then 0 else 1) @@ -1325,9 +1325,9 @@ module FSharpExprConvert = let env = { env with suppressWitnesses = true } ConvExpr cenv env eq E.IfThenElse (eqR, ConvDecisionTree cenv env dtreeRetTy dtree m, acc) - | DecisionTreeTest.IsInst (_srcty, tgty) -> + | DecisionTreeTest.IsInst (_srcTy, tgtTy) -> let e1R = ConvExpr cenv env inpExpr - E.IfThenElse (E.TypeTest (ConvType cenv tgty, e1R) |> Mk cenv m g.bool_ty, ConvDecisionTree cenv env dtreeRetTy dtree m, acc) + E.IfThenElse (E.TypeTest (ConvType cenv tgtTy, e1R) |> Mk cenv m g.bool_ty, ConvDecisionTree cenv env dtreeRetTy dtree m, acc) | DecisionTreeTest.ActivePatternCase _ -> wfail("unexpected Test.ActivePatternCase test in quoted expression", m) | DecisionTreeTest.ArrayLength _ -> wfail("FSharp.Compiler.Service cannot yet return array pattern matching", m) | DecisionTreeTest.Error m -> wfail("error recovery", m) diff --git a/src/Compiler/Symbols/SymbolHelpers.fs b/src/Compiler/Symbols/SymbolHelpers.fs index f65cd4541cc..c265024fc40 100644 --- a/src/Compiler/Symbols/SymbolHelpers.fs +++ b/src/Compiler/Symbols/SymbolHelpers.fs @@ -631,9 +631,9 @@ module internal SymbolHelpers = match item with | Item.Types(_name, tys) -> match tys with - | [AppTy g (tyconRef, _typeInst)] -> - if tyconRef.IsProvidedErasedTycon || tyconRef.IsProvidedGeneratedTycon then - Some tyconRef + | [AppTy g (tcref, _typeInst)] -> + if tcref.IsProvidedErasedTycon || tcref.IsProvidedGeneratedTycon then + Some tcref else None | _ -> None @@ -644,10 +644,10 @@ module internal SymbolHelpers = match item with | Item.Types(_name, tys) -> match tys with - | [AppTy g (tyconRef, _typeInst)] -> - if tyconRef.IsProvidedErasedTycon || tyconRef.IsProvidedGeneratedTycon then + | [AppTy g (tcref, _typeInst)] -> + if tcref.IsProvidedErasedTycon || tcref.IsProvidedGeneratedTycon then let typeBeforeArguments = - match tyconRef.TypeReprInfo with + match tcref.TypeReprInfo with | TProvidedTypeRepr info -> info.ProvidedType | _ -> failwith "unreachable" let staticParameters = typeBeforeArguments.PApplyWithProvider((fun (typeBeforeArguments, provider) -> typeBeforeArguments.GetStaticParameters provider), range=m) diff --git a/src/Compiler/Symbols/SymbolPatterns.fs b/src/Compiler/Symbols/SymbolPatterns.fs index bddfe60e135..e44375cb97c 100644 --- a/src/Compiler/Symbols/SymbolPatterns.fs +++ b/src/Compiler/Symbols/SymbolPatterns.fs @@ -43,7 +43,7 @@ module FSharpSymbolPatterns = if entity.IsFSharpAbbreviation then match entity.AbbreviatedType with | TypeWithDefinition def -> getEntityAbbreviatedType def - | abbreviatedType -> entity, Some abbreviatedType + | abbreviatedTy -> entity, Some abbreviatedTy else entity, None let (|Attribute|_|) (entity: FSharpEntity) = @@ -151,12 +151,12 @@ module FSharpSymbolPatterns = | _ -> false if isMutable then Some() else None - /// Entity (originalEntity, abbreviatedEntity, abbreviatedType) + /// Entity (originalEntity, abbreviatedEntity, abbreviatedTy) let (|FSharpEntity|_|) (symbol: FSharpSymbol) = match symbol with | :? FSharpEntity as entity -> - let abbreviatedEntity, abbreviatedType = getEntityAbbreviatedType entity - Some (entity, abbreviatedEntity, abbreviatedType) + let abbreviatedEntity, abbreviatedTy = getEntityAbbreviatedType entity + Some (entity, abbreviatedEntity, abbreviatedTy) | _ -> None let (|Parameter|_|) (symbol: FSharpSymbol) = diff --git a/src/Compiler/Symbols/Symbols.fs b/src/Compiler/Symbols/Symbols.fs index 6475f93a08d..602ccb7459d 100644 --- a/src/Compiler/Symbols/Symbols.fs +++ b/src/Compiler/Symbols/Symbols.fs @@ -350,7 +350,7 @@ type FSharpSymbol(cenv: SymbolEnv, item: unit -> Item, access: FSharpSymbol -> C member sym.TryGetAttribute<'T>() = sym.Attributes |> Seq.tryFind (fun attr -> attr.IsAttribute<'T>()) -type FSharpEntity(cenv: SymbolEnv, entity:EntityRef) = +type FSharpEntity(cenv: SymbolEnv, entity: EntityRef) = inherit FSharpSymbol(cenv, (fun () -> checkEntityIsResolved entity @@ -588,8 +588,8 @@ type FSharpEntity(cenv: SymbolEnv, entity:EntityRef) = if isUnresolved() then makeReadOnlyCollection [] else let ty = generalizedTyconRef cenv.g entity DiagnosticsLogger.protectAssemblyExploration [] (fun () -> - [ for ity in GetImmediateInterfacesOfType SkipUnrefInterfaces.Yes cenv.g cenv.amap range0 ty do - yield FSharpType(cenv, ity) ]) + [ for intfTy in GetImmediateInterfacesOfType SkipUnrefInterfaces.Yes cenv.g cenv.amap range0 ty do + yield FSharpType(cenv, intfTy) ]) |> makeReadOnlyCollection member _.AllInterfaces = @@ -642,10 +642,13 @@ type FSharpEntity(cenv: SymbolEnv, entity:EntityRef) = else for minfo in GetImmediateIntrinsicMethInfosOfType (None, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 entityTy do yield createMember minfo + let props = GetImmediateIntrinsicPropInfosOfType (None, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 entityTy let events = cenv.infoReader.GetImmediateIntrinsicEventsOfType (None, AccessibleFromSomeFSharpCode, range0, entityTy) + for pinfo in props do yield FSharpMemberOrFunctionOrValue(cenv, P pinfo, Item.Property (pinfo.PropertyName, [pinfo])) + for einfo in events do yield FSharpMemberOrFunctionOrValue(cenv, E einfo, Item.Event einfo) @@ -657,8 +660,8 @@ type FSharpEntity(cenv: SymbolEnv, entity:EntityRef) = let vref = mkNestedValRef entity v yield FSharpMemberOrFunctionOrValue(cenv, V vref, Item.Value vref) match v.MemberInfo.Value.MemberFlags.MemberKind, v.ApparentEnclosingEntity with - | SynMemberKind.PropertyGet, Parent p -> - let pinfo = FSProp(cenv.g, generalizedTyconRef cenv.g p, Some vref, None) + | SynMemberKind.PropertyGet, Parent tcref -> + let pinfo = FSProp(cenv.g, generalizedTyconRef cenv.g tcref, Some vref, None) yield FSharpMemberOrFunctionOrValue(cenv, P pinfo, Item.Property (pinfo.PropertyName, [pinfo])) | SynMemberKind.PropertySet, Parent p -> let pinfo = FSProp(cenv.g, generalizedTyconRef cenv.g p, None, Some vref) @@ -1306,7 +1309,7 @@ type FSharpActivePatternGroup(cenv, apinfo:ActivePatternInfo, ty, valOpt) = |> Option.bind (fun vref -> match vref.DeclaringEntity with | ParentNone -> None - | Parent p -> Some (FSharpEntity(cenv, p))) + | Parent tcref -> Some (FSharpEntity(cenv, tcref))) type FSharpGenericParameter(cenv, v:Typar) = @@ -1411,7 +1414,7 @@ type FSharpAbstractSignature(cenv, info: SlotSig) = member _.Name = info.Name - member _.DeclaringType = FSharpType(cenv, info.ImplementedType) + member _.DeclaringType = FSharpType(cenv, info.DeclaringType) type FSharpGenericParameterMemberConstraint(cenv, info: TraitConstraintInfo) = let (TTrait(tys, nm, flags, atys, retTy, _)) = info @@ -2076,7 +2079,7 @@ type FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = | E e -> // INCOMPLETENESS: Attribs is empty here, so we can't look at return attributes for .NET or F# methods let retTy = - try PropTypOfEventInfo cenv.infoReader range0 AccessibleFromSomewhere e + try PropTypeOfEventInfo cenv.infoReader range0 AccessibleFromSomewhere e with _ -> // For non-standard events, just use the delegate type as the ReturnParameter type e.GetDelegateType(cenv.amap, range0) @@ -2197,17 +2200,17 @@ type FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = member _.IsValCompiledAsMethod = match d with - | V valRef -> IlxGen.IsFSharpValCompiledAsMethod cenv.g valRef.Deref + | V vref -> IlxGen.IsFSharpValCompiledAsMethod cenv.g vref.Deref | _ -> false member _.IsValue = match d with - | V valRef -> not (isForallFunctionTy cenv.g valRef.Type) + | V vref -> not (isForallFunctionTy cenv.g vref.Type) | _ -> false member _.IsFunction = match d with - | V valRef -> isForallFunctionTy cenv.g valRef.Type + | V vref -> isForallFunctionTy cenv.g vref.Type | _ -> false override x.Equals(other: obj) = @@ -2326,7 +2329,7 @@ type FSharpType(cenv, ty:TType) = DiagnosticsLogger.protectAssemblyExploration true <| fun () -> match stripTyparEqns ty with | TType_app (tcref, _, _) -> FSharpEntity(cenv, tcref).IsUnresolved - | TType_measure (Measure.Con tcref) -> FSharpEntity(cenv, tcref).IsUnresolved + | TType_measure (Measure.Const tcref) -> FSharpEntity(cenv, tcref).IsUnresolved | TType_measure (Measure.Prod _) -> FSharpEntity(cenv, cenv.g.measureproduct_tcr).IsUnresolved | TType_measure Measure.One -> FSharpEntity(cenv, cenv.g.measureone_tcr).IsUnresolved | TType_measure (Measure.Inv _) -> FSharpEntity(cenv, cenv.g.measureinverse_tcr).IsUnresolved @@ -2342,7 +2345,7 @@ type FSharpType(cenv, ty:TType) = isResolved() && protect <| fun () -> match stripTyparEqns ty with - | TType_app _ | TType_measure (Measure.Con _ | Measure.Prod _ | Measure.Inv _ | Measure.One _) -> true + | TType_app _ | TType_measure (Measure.Const _ | Measure.Prod _ | Measure.Inv _ | Measure.One _) -> true | _ -> false member _.IsTupleType = @@ -2363,7 +2366,7 @@ type FSharpType(cenv, ty:TType) = protect <| fun () -> match stripTyparEqns ty with | TType_app (tcref, _, _) -> FSharpEntity(cenv, tcref) - | TType_measure (Measure.Con tcref) -> FSharpEntity(cenv, tcref) + | TType_measure (Measure.Const tcref) -> FSharpEntity(cenv, tcref) | TType_measure (Measure.Prod _) -> FSharpEntity(cenv, cenv.g.measureproduct_tcr) | TType_measure Measure.One -> FSharpEntity(cenv, cenv.g.measureone_tcr) | TType_measure (Measure.Inv _) -> FSharpEntity(cenv, cenv.g.measureinverse_tcr) @@ -2375,8 +2378,8 @@ type FSharpType(cenv, ty:TType) = | TType_anon (_, tyargs) | TType_app (_, tyargs, _) | TType_tuple (_, tyargs) -> (tyargs |> List.map (fun ty -> FSharpType(cenv, ty)) |> makeReadOnlyCollection) - | TType_fun(d, r, _) -> [| FSharpType(cenv, d); FSharpType(cenv, r) |] |> makeReadOnlyCollection - | TType_measure (Measure.Con _) -> [| |] |> makeReadOnlyCollection + | TType_fun(domainTy, rangeTy, _) -> [| FSharpType(cenv, domainTy); FSharpType(cenv, rangeTy) |] |> makeReadOnlyCollection + | TType_measure (Measure.Const _) -> [| |] |> makeReadOnlyCollection | TType_measure (Measure.Prod (t1, t2)) -> [| FSharpType(cenv, TType_measure t1); FSharpType(cenv, TType_measure t2) |] |> makeReadOnlyCollection | TType_measure Measure.One -> [| |] |> makeReadOnlyCollection | TType_measure (Measure.Inv t1) -> [| FSharpType(cenv, TType_measure t1) |] |> makeReadOnlyCollection @@ -2443,8 +2446,8 @@ type FSharpType(cenv, ty:TType) = |> Option.map (fun ty -> FSharpType(cenv, ty)) member _.Instantiate(instantiation:(FSharpGenericParameter * FSharpType) list) = - let typI = instType (instantiation |> List.map (fun (tyv, ty) -> tyv.TypeParameter, ty.Type)) ty - FSharpType(cenv, typI) + let resTy = instType (instantiation |> List.map (fun (tyv, ty) -> tyv.TypeParameter, ty.Type)) ty + FSharpType(cenv, resTy) member _.Type = ty member private x.cenv = cenv @@ -2469,7 +2472,7 @@ type FSharpType(cenv, ty:TType) = | TType_app (tc1, b1, _) -> 10200 + int32 tc1.Stamp + List.sumBy hashType b1 | TType_ucase _ -> 10300 // shouldn't occur in symbols | TType_tuple (_, l1) -> 10400 + List.sumBy hashType l1 - | TType_fun (dty, rty, _) -> 10500 + hashType dty + hashType rty + | TType_fun (domainTy, rangeTy, _) -> 10500 + hashType domainTy + hashType rangeTy | TType_measure _ -> 10600 | TType_anon (_,l1) -> 10800 + List.sumBy hashType l1 hashType ty @@ -2593,9 +2596,9 @@ type FSharpStaticParameter(cenv, sp: Tainted< TypeProviders.ProvidedParameterInf inherit FSharpSymbol(cenv, (fun () -> protect <| fun () -> - let spKind = Import.ImportProvidedType cenv.amap m (sp.PApply((fun x -> x.ParameterType), m)) + let paramTy = Import.ImportProvidedType cenv.amap m (sp.PApply((fun x -> x.ParameterType), m)) let nm = sp.PUntaint((fun p -> p.Name), m) - Item.ArgName((mkSynId m nm, spKind, None))), + Item.ArgName((mkSynId m nm, paramTy, None))), (fun _ _ _ -> true)) member _.Name = diff --git a/src/Compiler/SyntaxTree/SyntaxTreeOps.fs b/src/Compiler/SyntaxTree/SyntaxTreeOps.fs index 546a1b1ade7..1834bb0fbf7 100644 --- a/src/Compiler/SyntaxTree/SyntaxTreeOps.fs +++ b/src/Compiler/SyntaxTree/SyntaxTreeOps.fs @@ -373,12 +373,12 @@ let mkSynOperator (opm: range) (oper: string) = let mkSynInfix opm (l: SynExpr) oper (r: SynExpr) = let firstTwoRange = unionRanges l.Range opm - let wholeRange = unionRanges l.Range r.Range + let mWhole = unionRanges l.Range r.Range let app1 = SynExpr.App(ExprAtomicFlag.NonAtomic, true, mkSynOperator opm oper, l, firstTwoRange) - SynExpr.App(ExprAtomicFlag.NonAtomic, false, app1, r, wholeRange) + SynExpr.App(ExprAtomicFlag.NonAtomic, false, app1, r, mWhole) let mkSynBifix m oper x1 x2 = let app1 = SynExpr.App(ExprAtomicFlag.NonAtomic, true, mkSynOperator m oper, x1, m) @@ -417,17 +417,17 @@ let mkSynDotBrackGet m mDot a b = SynExpr.DotIndexedGet(a, b, mDot, m) let mkSynQMarkSet m a b c = mkSynTrifix m qmarkSet a b c -let mkSynDotParenGet lhsm dotm a b = +let mkSynDotParenGet mLhs mDot a b = match b with | SynExpr.Tuple (false, [ _; _ ], _, _) -> - errorR (Deprecated(FSComp.SR.astDeprecatedIndexerNotation (), lhsm)) - SynExpr.Const(SynConst.Unit, lhsm) + errorR (Deprecated(FSComp.SR.astDeprecatedIndexerNotation (), mLhs)) + SynExpr.Const(SynConst.Unit, mLhs) | SynExpr.Tuple (false, [ _; _; _ ], _, _) -> - errorR (Deprecated(FSComp.SR.astDeprecatedIndexerNotation (), lhsm)) - SynExpr.Const(SynConst.Unit, lhsm) + errorR (Deprecated(FSComp.SR.astDeprecatedIndexerNotation (), mLhs)) + SynExpr.Const(SynConst.Unit, mLhs) - | _ -> mkSynInfix dotm a parenGet b + | _ -> mkSynInfix mDot a parenGet b let mkSynUnit m = SynExpr.Const(SynConst.Unit, m) @@ -452,24 +452,24 @@ let mkSynAssign (l: SynExpr) (r: SynExpr) = | SynExpr.App (_, _, SynExpr.DotGet (e, _, v, _), x, _) -> SynExpr.DotNamedIndexedPropertySet(e, v, x, r, m) | l -> SynExpr.Set(l, r, m) -let mkSynDot dotm m l (SynIdent (r, rTrivia)) = +let mkSynDot mDot m l (SynIdent (r, rTrivia)) = match l with | SynExpr.LongIdent (isOpt, SynLongIdent (lid, dots, trivia), None, _) -> // REVIEW: MEMORY PERFORMANCE: This list operation is memory intensive (we create a lot of these list nodes) - SynExpr.LongIdent(isOpt, SynLongIdent(lid @ [ r ], dots @ [ dotm ], trivia @ [ rTrivia ]), None, m) - | SynExpr.Ident id -> SynExpr.LongIdent(false, SynLongIdent([ id; r ], [ dotm ], [ None; rTrivia ]), None, m) + SynExpr.LongIdent(isOpt, SynLongIdent(lid @ [ r ], dots @ [ mDot ], trivia @ [ rTrivia ]), None, m) + | SynExpr.Ident id -> SynExpr.LongIdent(false, SynLongIdent([ id; r ], [ mDot ], [ None; rTrivia ]), None, m) | SynExpr.DotGet (e, dm, SynLongIdent (lid, dots, trivia), _) -> // REVIEW: MEMORY PERFORMANCE: This is memory intensive (we create a lot of these list nodes) - SynExpr.DotGet(e, dm, SynLongIdent(lid @ [ r ], dots @ [ dotm ], trivia @ [ rTrivia ]), m) - | expr -> SynExpr.DotGet(expr, dotm, SynLongIdent([ r ], [], [ rTrivia ]), m) + SynExpr.DotGet(e, dm, SynLongIdent(lid @ [ r ], dots @ [ mDot ], trivia @ [ rTrivia ]), m) + | expr -> SynExpr.DotGet(expr, mDot, SynLongIdent([ r ], [], [ rTrivia ]), m) -let mkSynDotMissing dotm m l = +let mkSynDotMissing mDot m l = match l with | SynExpr.LongIdent (isOpt, SynLongIdent (lid, dots, trivia), None, _) -> // REVIEW: MEMORY PERFORMANCE: This list operation is memory intensive (we create a lot of these list nodes) - SynExpr.LongIdent(isOpt, SynLongIdent(lid, dots @ [ dotm ], trivia), None, m) - | SynExpr.Ident id -> SynExpr.LongIdent(false, SynLongIdent([ id ], [ dotm ], []), None, m) - | SynExpr.DotGet (e, dm, SynLongIdent (lid, dots, trivia), _) -> SynExpr.DotGet(e, dm, SynLongIdent(lid, dots @ [ dotm ], trivia), m) // REVIEW: MEMORY PERFORMANCE: This is memory intensive (we create a lot of these list nodes) + SynExpr.LongIdent(isOpt, SynLongIdent(lid, dots @ [ mDot ], trivia), None, m) + | SynExpr.Ident id -> SynExpr.LongIdent(false, SynLongIdent([ id ], [ mDot ], []), None, m) + | SynExpr.DotGet (e, dm, SynLongIdent (lid, dots, trivia), _) -> SynExpr.DotGet(e, dm, SynLongIdent(lid, dots @ [ mDot ], trivia), m) // REVIEW: MEMORY PERFORMANCE: This is memory intensive (we create a lot of these list nodes) | expr -> SynExpr.DiscardAfterMissingQualificationAfterDot(expr, m) let mkSynFunMatchLambdas synArgNameGenerator isMember wholem ps arrow e = @@ -974,9 +974,9 @@ let (|ParsedHashDirectiveArguments|) (input: ParsedHashDirectiveArgument list) = | ParsedHashDirectiveArgument.SourceIdentifier (_, v, _) -> v) input -let prependIdentInLongIdentWithTrivia (SynIdent (ident, identTrivia)) dotm lid = +let prependIdentInLongIdentWithTrivia (SynIdent (ident, identTrivia)) mDot lid = match lid with - | SynLongIdent (lid, dots, trivia) -> SynLongIdent(ident :: lid, dotm :: dots, identTrivia :: trivia) + | SynLongIdent (lid, dots, trivia) -> SynLongIdent(ident :: lid, mDot :: dots, identTrivia :: trivia) let mkDynamicArgExpr expr = match expr with diff --git a/src/Compiler/SyntaxTree/SyntaxTreeOps.fsi b/src/Compiler/SyntaxTree/SyntaxTreeOps.fsi index edda8d21d5b..0c7010b40fa 100644 --- a/src/Compiler/SyntaxTree/SyntaxTreeOps.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTreeOps.fsi @@ -143,7 +143,7 @@ val mkSynQMarkSet: m: range -> a: SynExpr -> b: SynExpr -> c: SynExpr -> SynExpr //val mkSynDotBrackSeqSliceGet: m:range -> mDot:range -> arr:SynExpr -> argsList:SynIndexerArg list -> SynExpr -val mkSynDotParenGet: lhsm: range -> dotm: range -> a: SynExpr -> b: SynExpr -> SynExpr +val mkSynDotParenGet: mLhs: range -> mDot: range -> a: SynExpr -> b: SynExpr -> SynExpr val mkSynUnit: m: range -> SynExpr @@ -153,9 +153,9 @@ val mkSynDelay: m: range -> e: SynExpr -> SynExpr val mkSynAssign: l: SynExpr -> r: SynExpr -> SynExpr -val mkSynDot: dotm: range -> m: range -> l: SynExpr -> r: SynIdent -> SynExpr +val mkSynDot: mDot: range -> m: range -> l: SynExpr -> r: SynIdent -> SynExpr -val mkSynDotMissing: dotm: range -> m: range -> l: SynExpr -> SynExpr +val mkSynDotMissing: mDot: range -> m: range -> l: SynExpr -> SynExpr val mkSynFunMatchLambdas: synArgNameGenerator: SynArgNameGenerator -> @@ -337,7 +337,7 @@ val (|SynPipeRight2|_|): SynExpr -> (SynExpr * SynExpr * SynExpr) option /// 'e1 |||> e2' val (|SynPipeRight3|_|): SynExpr -> (SynExpr * SynExpr * SynExpr * SynExpr) option -val prependIdentInLongIdentWithTrivia: ident: SynIdent -> dotm: range -> lid: SynLongIdent -> SynLongIdent +val prependIdentInLongIdentWithTrivia: ident: SynIdent -> mDot: range -> lid: SynLongIdent -> SynLongIdent val mkDynamicArgExpr: expr: SynExpr -> SynExpr diff --git a/src/Compiler/TypedTree/TcGlobals.fs b/src/Compiler/TypedTree/TcGlobals.fs index 51060755e80..5075d68b504 100755 --- a/src/Compiler/TypedTree/TcGlobals.fs +++ b/src/Compiler/TypedTree/TcGlobals.fs @@ -564,8 +564,8 @@ type TcGlobals( let tryDecodeTupleTy tupInfo l = match l with - | [t1;t2;t3;t4;t5;t6;t7;marker] -> - match marker with + | [t1;t2;t3;t4;t5;t6;t7;markerTy] -> + match markerTy with | TType_app(tcref, [t8], _) when tyconRefEq tcref v_ref_tuple1_tcr -> mkRawRefTupleTy [t1;t2;t3;t4;t5;t6;t7;t8] |> Some | TType_app(tcref, [t8], _) when tyconRefEq tcref v_struct_tuple1_tcr -> mkRawStructTupleTy [t1;t2;t3;t4;t5;t6;t7;t8] |> Some | TType_tuple (_structness2, t8plus) -> TType_tuple (tupInfo, [t1;t2;t3;t4;t5;t6;t7] @ t8plus) |> Some @@ -1779,7 +1779,7 @@ type TcGlobals( [ arg0Ty; arg1Ty ], Some retTy -> [vara; varb; varc], [ varaTy; varbTy ], varcTy, [ arg0Ty; arg1Ty; retTy ] - | ("UnaryNegationDynamic" | "CheckedUnaryNegationDynamic" | "LogicalNotDynamic" | "ExplicitDynamic"), + | ("UnaryNegationDynamic" | "CheckedUnaryNegationDynamic" | "LogicalNotDynamic" | "ExplicitDynamic" | "CheckedExplicitDynamic"), [ arg0Ty ], Some retTy -> [vara; varb ], [ varaTy ], varbTy, [ arg0Ty; retTy ] @@ -1832,11 +1832,11 @@ type TcGlobals( let info = makeOtherIntrinsicValRef (fslib_MFOperators_nleref, lower, None, Some nm, [vara], ([[varaTy]], varaTy)) let tyargs = [aty] Some (info, tyargs, argExprs) - | "get_Item", [arrTy; _], Some rty, [_; _] when isArrayTy g arrTy -> - Some (g.array_get_info, [rty], argExprs) - | "set_Item", [arrTy; _; ety], _, [_; _; _] when isArrayTy g arrTy -> - Some (g.array_set_info, [ety], argExprs) - | "get_Item", [sty; _; _], _, [_; _] when isStringTy g sty -> + | "get_Item", [arrTy; _], Some retTy, [_; _] when isArrayTy g arrTy -> + Some (g.array_get_info, [retTy], argExprs) + | "set_Item", [arrTy; _; elemTy], _, [_; _; _] when isArrayTy g arrTy -> + Some (g.array_set_info, [elemTy], argExprs) + | "get_Item", [stringTy; _; _], _, [_; _] when isStringTy g stringTy -> Some (g.getstring_info, [], argExprs) | "op_UnaryPlus", [aty], _, [_] -> // Call Operators.id diff --git a/src/Compiler/TypedTree/TypedTree.fs b/src/Compiler/TypedTree/TypedTree.fs index 2d3f8c0943f..d71fd222745 100644 --- a/src/Compiler/TypedTree/TypedTree.fs +++ b/src/Compiler/TypedTree/TypedTree.fs @@ -1156,7 +1156,7 @@ type Entity = member x.MembersOfFSharpTyconSorted = x.TypeContents.tcaug_adhoc |> NameMultiMap.rangeReversingEachBucket - |> List.filter (fun v -> not v.IsCompilerGenerated) + |> List.filter (fun vref -> not vref.IsCompilerGenerated) /// Gets all immediate members of an F# type definition keyed by name, including compiler-generated ones. /// Note: result is a indexed table, and for each name the results are in reverse declaration order @@ -1179,16 +1179,16 @@ type Entity = member x.AllGeneratedValues = [ match x.GeneratedCompareToValues with | None -> () - | Some (v1, v2) -> yield v1; yield v2 + | Some (vref1, vref2) -> yield vref1; yield vref2 match x.GeneratedCompareToWithComparerValues with | None -> () | Some v -> yield v match x.GeneratedHashAndEqualsValues with | None -> () - | Some (v1, v2) -> yield v1; yield v2 + | Some (vref1, vref2) -> yield vref1; yield vref2 match x.GeneratedHashAndEqualsWithComparerValues with | None -> () - | Some (v1, v2, v3) -> yield v1; yield v2; yield v3 ] + | Some (vref1, vref2, vref3) -> yield vref1; yield vref2; yield vref3 ] /// Gets the data indicating the compiled representation of a type or module in terms of Abstract IL data structures. @@ -3720,32 +3720,32 @@ type ValRef = member x.ResolvedTarget = x.binding /// Dereference the ValRef to a Val. - member vr.Deref = - if obj.ReferenceEquals(vr.binding, null) then + member x.Deref = + if obj.ReferenceEquals(x.binding, null) then let res = - let nlr = vr.nlr + let nlr = x.nlr let e = nlr.EnclosingEntity.Deref let possible = e.ModuleOrNamespaceType.TryLinkVal(nlr.EnclosingEntity.nlr.Ccu, nlr.ItemKey) match possible with | ValueNone -> error (InternalUndefinedItemRef (FSComp.SR.tastUndefinedItemRefVal, e.DisplayNameWithStaticParameters, nlr.AssemblyName, sprintf "%+A" nlr.ItemKey.PartialKey)) | ValueSome h -> h - vr.binding <- nullableSlotFull res + x.binding <- nullableSlotFull res res - else vr.binding + else x.binding /// Dereference the ValRef to a Val option. - member vr.TryDeref = - if obj.ReferenceEquals(vr.binding, null) then + member x.TryDeref = + if obj.ReferenceEquals(x.binding, null) then let resOpt = - match vr.nlr.EnclosingEntity.TryDeref with + match x.nlr.EnclosingEntity.TryDeref with | ValueNone -> ValueNone - | ValueSome e -> e.ModuleOrNamespaceType.TryLinkVal(vr.nlr.EnclosingEntity.nlr.Ccu, vr.nlr.ItemKey) + | ValueSome e -> e.ModuleOrNamespaceType.TryLinkVal(x.nlr.EnclosingEntity.nlr.Ccu, x.nlr.ItemKey) match resOpt with | ValueNone -> () | ValueSome res -> - vr.binding <- nullableSlotFull res + x.binding <- nullableSlotFull res resOpt - else ValueSome vr.binding + else ValueSome x.binding /// The type of the value. May be a TType_forall for a generic value. /// May be a type variable or type containing type variables during type inference. @@ -3942,7 +3942,7 @@ type ValRef = /// Represents a reference to a case of a union type [] type UnionCaseRef = - | UnionCaseRef of TyconRef * string + | UnionCaseRef of tyconRef: TyconRef * caseName: string /// Get a reference to the type containing this union case member x.TyconRef = let (UnionCaseRef(tcref, _)) = x in tcref @@ -4001,7 +4001,7 @@ type UnionCaseRef = /// Represents a reference to a field in a record, class or struct [] type RecdFieldRef = - | RecdFieldRef of tcref: TyconRef * id: string + | RecdFieldRef of tyconRef: TyconRef * fieldName: string /// Get a reference to the type containing this union case member x.TyconRef = let (RecdFieldRef(tcref, _)) = x in tcref @@ -4098,7 +4098,7 @@ type TType = | TType_anon (anonInfo, _tinst) -> defaultArg anonInfo.Assembly.QualifiedName "" | TType_fun _ -> "" | TType_measure _ -> "" - | TType_var (tp, _) -> tp.Solution |> function Some sln -> sln.GetAssemblyName() | None -> "" + | TType_var (tp, _) -> tp.Solution |> function Some slnTy -> slnTy.GetAssemblyName() | None -> "" | TType_ucase (_uc, _tinst) -> let (TILObjectReprData(scope, _nesting, _definition)) = _uc.Tycon.ILTyconInfo scope.QualifiedName @@ -4120,7 +4120,7 @@ type TType = | TupInfo.Const false -> "" | TupInfo.Const true -> "struct ") + "{|" + String.concat "," (Seq.map2 (fun nm ty -> nm + " " + string ty + ";") anonInfo.SortedNames tinst) + ")" + "|}" - | TType_fun (d, r, _) -> "(" + string d + " -> " + string r + ")" + | TType_fun (domainTy, retTy, _) -> "(" + string domainTy + " -> " + string retTy + ")" | TType_ucase (uc, tinst) -> "ucase " + uc.CaseName + (match tinst with [] -> "" | tys -> "<" + String.concat "," (List.map string tys) + ">") | TType_var (tp, _) -> match tp.Solution with @@ -4197,7 +4197,7 @@ type Measure = | Var of typar: Typar /// A constant, leaf unit-of-measure such as 'kg' or 'm' - | Con of tyconRef: TyconRef + | Const of tyconRef: TyconRef /// A product of two units of measure | Prod of measure1: Measure * measure2: Measure @@ -5061,7 +5061,7 @@ type ObjExprMethod = type SlotSig = | TSlotSig of methodName: string * - implementedType: TType * + declaringType: TType * classTypars: Typars * methodTypars: Typars * formalParams: SlotParam list list * @@ -5071,7 +5071,7 @@ type SlotSig = member ss.Name = let (TSlotSig(nm, _, _, _, _, _)) = ss in nm /// The (instantiated) type which the slot is logically a part of - member ss.ImplementedType = let (TSlotSig(_, ty, _, _, _, _)) = ss in ty + member ss.DeclaringType = let (TSlotSig(_, ty, _, _, _, _)) = ss in ty /// The class type parameters of the slot member ss.ClassTypars = let (TSlotSig(_, _, ctps, _, _, _)) = ss in ctps diff --git a/src/Compiler/TypedTree/TypedTree.fsi b/src/Compiler/TypedTree/TypedTree.fsi index cdcf93e4518..57037ba27d8 100644 --- a/src/Compiler/TypedTree/TypedTree.fsi +++ b/src/Compiler/TypedTree/TypedTree.fsi @@ -2818,7 +2818,7 @@ type ValRef = /// Represents a reference to a case of a union type [] type UnionCaseRef = - | UnionCaseRef of TyconRef * string + | UnionCaseRef of tyconRef: TyconRef * caseName: string /// Get a field of the union case by index member FieldByIndex: n: int -> RecdField @@ -2867,7 +2867,7 @@ type UnionCaseRef = /// Represents a reference to a field in a record, class or struct [] type RecdFieldRef = - | RecdFieldRef of tcref: TyconRef * id: string + | RecdFieldRef of tyconRef: TyconRef * fieldName: string override ToString: unit -> string @@ -2990,7 +2990,7 @@ type Measure = | Var of typar: Typar /// A constant, leaf unit-of-measure such as 'kg' or 'm' - | Con of tyconRef: TyconRef + | Const of tyconRef: TyconRef /// A product of two units of measure | Prod of measure1: Measure * measure2: Measure @@ -3688,7 +3688,7 @@ type ObjExprMethod = type SlotSig = | TSlotSig of methodName: string * - implementedType: TType * + declaringType: TType * classTypars: Typars * methodTypars: Typars * formalParams: SlotParam list list * @@ -3709,7 +3709,7 @@ type SlotSig = member FormalReturnType: TType option /// The (instantiated) type which the slot is logically a part of - member ImplementedType: TType + member DeclaringType: TType /// The method type parameters of the slot member MethodTypars: Typars diff --git a/src/Compiler/TypedTree/TypedTreeBasics.fs b/src/Compiler/TypedTree/TypedTreeBasics.fs index 1ec0b619604..63a45fb9b9a 100644 --- a/src/Compiler/TypedTree/TypedTreeBasics.fs +++ b/src/Compiler/TypedTree/TypedTreeBasics.fs @@ -93,24 +93,24 @@ let mkRawStructTupleTy tys = TType_tuple (tupInfoStruct, tys) // Equality relations on locally defined things //--------------------------------------------------------------------------- -let typarEq (lv1: Typar) (lv2: Typar) = (lv1.Stamp = lv2.Stamp) +let typarEq (tp1: Typar) (tp2: Typar) = (tp1.Stamp = tp2.Stamp) /// Equality on type variables, implemented as reference equality. This should be equivalent to using typarEq. let typarRefEq (tp1: Typar) (tp2: Typar) = (tp1 === tp2) /// Equality on value specs, implemented as reference equality -let valEq (lv1: Val) (lv2: Val) = (lv1 === lv2) +let valEq (v1: Val) (v2: Val) = (v1 === v2) /// Equality on CCU references, implemented as reference equality except when unresolved -let ccuEq (mv1: CcuThunk) (mv2: CcuThunk) = - (mv1 === mv2) || - (if mv1.IsUnresolvedReference || mv2.IsUnresolvedReference then - mv1.AssemblyName = mv2.AssemblyName +let ccuEq (ccu1: CcuThunk) (ccu2: CcuThunk) = + (ccu1 === ccu2) || + (if ccu1.IsUnresolvedReference || ccu2.IsUnresolvedReference then + ccu1.AssemblyName = ccu2.AssemblyName else - mv1.Contents === mv2.Contents) + ccu1.Contents === ccu2.Contents) /// For dereferencing in the middle of a pattern -let (|ValDeref|) (vr: ValRef) = vr.Deref +let (|ValDeref|) (vref: ValRef) = vref.Deref //-------------------------------------------------------------------------- // Make references to TAST items diff --git a/src/Compiler/TypedTree/TypedTreeBasics.fsi b/src/Compiler/TypedTree/TypedTreeBasics.fsi index fe4930a71d7..e739aec4062 100644 --- a/src/Compiler/TypedTree/TypedTreeBasics.fsi +++ b/src/Compiler/TypedTree/TypedTreeBasics.fsi @@ -61,19 +61,19 @@ val mkRawRefTupleTy: tys: TTypes -> TType val mkRawStructTupleTy: tys: TTypes -> TType -val typarEq: lv1: Typar -> lv2: Typar -> bool +val typarEq: tp1: Typar -> tp2: Typar -> bool /// Equality on type variables, implemented as reference equality. This should be equivalent to using typarEq. val typarRefEq: tp1: Typar -> tp2: Typar -> bool /// Equality on value specs, implemented as reference equality -val valEq: lv1: Val -> lv2: Val -> bool +val valEq: v1: Val -> v2: Val -> bool /// Equality on CCU references, implemented as reference equality except when unresolved -val ccuEq: mv1: CcuThunk -> mv2: CcuThunk -> bool +val ccuEq: ccu1: CcuThunk -> ccu2: CcuThunk -> bool /// For dereferencing in the middle of a pattern -val (|ValDeref|): vr: ValRef -> Val +val (|ValDeref|): vref: ValRef -> Val val mkRecdFieldRef: tcref: TyconRef -> f: string -> RecdFieldRef diff --git a/src/Compiler/TypedTree/TypedTreeOps.fs b/src/Compiler/TypedTree/TypedTreeOps.fs index cef7fe70b74..8229107c74a 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.fs @@ -45,32 +45,32 @@ type TyparMap<'T> = | TPMap of StampMap<'T> member tm.Item - with get (v: Typar) = + with get (tp: Typar) = let (TPMap m) = tm - m[v.Stamp] + m[tp.Stamp] - member tm.ContainsKey (v: Typar) = + member tm.ContainsKey (tp: Typar) = let (TPMap m) = tm - m.ContainsKey(v.Stamp) + m.ContainsKey(tp.Stamp) - member tm.TryFind (v: Typar) = + member tm.TryFind (tp: Typar) = let (TPMap m) = tm - m.TryFind(v.Stamp) + m.TryFind(tp.Stamp) - member tm.Add (v: Typar, x) = + member tm.Add (tp: Typar, x) = let (TPMap m) = tm - TPMap (m.Add(v.Stamp, x)) + TPMap (m.Add(tp.Stamp, x)) static member Empty: TyparMap<'T> = TPMap Map.empty [] type TyconRefMap<'T>(imap: StampMap<'T>) = - member m.Item with get (v: TyconRef) = imap[v.Stamp] - member m.TryFind (v: TyconRef) = imap.TryFind v.Stamp - member m.ContainsKey (v: TyconRef) = imap.ContainsKey v.Stamp - member m.Add (v: TyconRef) x = TyconRefMap (imap.Add (v.Stamp, x)) - member m.Remove (v: TyconRef) = TyconRefMap (imap.Remove v.Stamp) - member m.IsEmpty = imap.IsEmpty + member _.Item with get (tcref: TyconRef) = imap[tcref.Stamp] + member _.TryFind (tcref: TyconRef) = imap.TryFind tcref.Stamp + member _.ContainsKey (tcref: TyconRef) = imap.ContainsKey tcref.Stamp + member _.Add (tcref: TyconRef) x = TyconRefMap (imap.Add (tcref.Stamp, x)) + member _.Remove (tcref: TyconRef) = TyconRefMap (imap.Remove tcref.Stamp) + member _.IsEmpty = imap.IsEmpty static member Empty: TyconRefMap<'T> = TyconRefMap Map.empty static member OfList vs = (vs, TyconRefMap<'T>.Empty) ||> List.foldBack (fun (x, y) acc -> acc.Add x y) @@ -79,14 +79,14 @@ type TyconRefMap<'T>(imap: StampMap<'T>) = [] type ValMap<'T>(imap: StampMap<'T>) = - member m.Contents = imap - member m.Item with get (v: Val) = imap[v.Stamp] - member m.TryFind (v: Val) = imap.TryFind v.Stamp - member m.ContainsVal (v: Val) = imap.ContainsKey v.Stamp - member m.Add (v: Val) x = ValMap (imap.Add(v.Stamp, x)) - member m.Remove (v: Val) = ValMap (imap.Remove(v.Stamp)) + member _.Contents = imap + member _.Item with get (v: Val) = imap[v.Stamp] + member _.TryFind (v: Val) = imap.TryFind v.Stamp + member _.ContainsVal (v: Val) = imap.ContainsKey v.Stamp + member _.Add (v: Val) x = ValMap (imap.Add(v.Stamp, x)) + member _.Remove (v: Val) = ValMap (imap.Remove(v.Stamp)) static member Empty = ValMap<'T> Map.empty - member m.IsEmpty = imap.IsEmpty + member _.IsEmpty = imap.IsEmpty static member OfList vs = (vs, ValMap<'T>.Empty) ||> List.foldBack (fun (x, y) acc -> acc.Add x y) //-------------------------------------------------------------------------- @@ -207,11 +207,11 @@ let rec remapTypeAux (tyenv: Remap) (ty: TType) = if tupInfo === tupInfoR && l === lR then ty else TType_tuple (tupInfoR, lR) - | TType_fun (d, r, flags) as ty -> - let dR = remapTypeAux tyenv d - let rR = remapTypeAux tyenv r - if d === dR && r === rR then ty else - TType_fun (dR, rR, flags) + | TType_fun (domainTy, rangeTy, flags) as ty -> + let domainTyR = remapTypeAux tyenv domainTy + let retTyR = remapTypeAux tyenv rangeTy + if domainTy === domainTyR && rangeTy === retTyR then ty else + TType_fun (domainTyR, retTyR, flags) | TType_forall (tps, ty) -> let tpsR, tyenv = copyAndRemapAndBindTypars tyenv tps @@ -224,9 +224,9 @@ let rec remapTypeAux (tyenv: Remap) (ty: TType) = and remapMeasureAux tyenv unt = match unt with | Measure.One -> unt - | Measure.Con tcref -> + | Measure.Const tcref -> match tyenv.tyconRefRemap.TryFind tcref with - | Some tcref -> Measure.Con tcref + | Some tcref -> Measure.Const tcref | None -> unt | Measure.Prod(u1, u2) -> Measure.Prod(remapMeasureAux tyenv u1, remapMeasureAux tyenv u2) | Measure.RationalPower(u, q) -> Measure.RationalPower(remapMeasureAux tyenv u, q) @@ -235,8 +235,8 @@ and remapMeasureAux tyenv unt = match tp.Solution with | None -> match ListAssoc.tryFind typarEq tp tyenv.tpinst with - | Some v -> - match v with + | Some tpTy -> + match tpTy with | TType_measure unt -> unt | _ -> failwith "remapMeasureAux: incorrect kinds" | None -> unt @@ -257,10 +257,10 @@ and remapTyparConstraintsAux tyenv cs = Some(TyparConstraint.MayResolveMember (remapTraitInfo tyenv traitInfo, m)) | TyparConstraint.DefaultsTo(priority, ty, m) -> Some(TyparConstraint.DefaultsTo(priority, remapTypeAux tyenv ty, m)) - | TyparConstraint.IsEnum(uty, m) -> - Some(TyparConstraint.IsEnum(remapTypeAux tyenv uty, m)) - | TyparConstraint.IsDelegate(uty1, uty2, m) -> - Some(TyparConstraint.IsDelegate(remapTypeAux tyenv uty1, remapTypeAux tyenv uty2, m)) + | TyparConstraint.IsEnum(underlyingTy, m) -> + Some(TyparConstraint.IsEnum(remapTypeAux tyenv underlyingTy, m)) + | TyparConstraint.IsDelegate(argTys, retTy, m) -> + Some(TyparConstraint.IsDelegate(remapTypeAux tyenv argTys, remapTypeAux tyenv retTy, m)) | TyparConstraint.SimpleChoice(tys, m) -> Some(TyparConstraint.SimpleChoice(remapTypesAux tyenv tys, m)) | TyparConstraint.SupportsComparison _ @@ -443,7 +443,7 @@ let reduceTyconRefAbbrevMeasureable (tcref: TyconRef) = let rec stripUnitEqnsFromMeasureAux canShortcut unt = match stripUnitEqnsAux canShortcut unt with - | Measure.Con tcref when tcref.IsTypeAbbrev -> + | Measure.Const tcref when tcref.IsTypeAbbrev -> stripUnitEqnsFromMeasureAux canShortcut (reduceTyconRefAbbrevMeasureable tcref) | m -> m @@ -456,7 +456,7 @@ let stripUnitEqnsFromMeasure m = stripUnitEqnsFromMeasureAux false m /// What is the contribution of unit-of-measure constant ucref to unit-of-measure expression measure? let rec MeasureExprConExponent g abbrev ucref unt = match (if abbrev then stripUnitEqnsFromMeasure unt else stripUnitEqns unt) with - | Measure.Con ucrefR -> if tyconRefEq g ucrefR ucref then OneRational else ZeroRational + | Measure.Const ucrefR -> if tyconRefEq g ucrefR ucref then OneRational else ZeroRational | Measure.Inv untR -> NegRational(MeasureExprConExponent g abbrev ucref untR) | Measure.Prod(unt1, unt2) -> AddRational(MeasureExprConExponent g abbrev ucref unt1) (MeasureExprConExponent g abbrev ucref unt2) | Measure.RationalPower(untR, q) -> MulRational (MeasureExprConExponent g abbrev ucref untR) q @@ -466,7 +466,7 @@ let rec MeasureExprConExponent g abbrev ucref unt = /// after remapping tycons? let rec MeasureConExponentAfterRemapping g r ucref unt = match stripUnitEqnsFromMeasure unt with - | Measure.Con ucrefR -> if tyconRefEq g (r ucrefR) ucref then OneRational else ZeroRational + | Measure.Const ucrefR -> if tyconRefEq g (r ucrefR) ucref then OneRational else ZeroRational | Measure.Inv untR -> NegRational(MeasureConExponentAfterRemapping g r ucref untR) | Measure.Prod(unt1, unt2) -> AddRational(MeasureConExponentAfterRemapping g r ucref unt1) (MeasureConExponentAfterRemapping g r ucref unt2) | Measure.RationalPower(untR, q) -> MulRational (MeasureConExponentAfterRemapping g r ucref untR) q @@ -511,7 +511,7 @@ let ListMeasureVarOccsWithNonZeroExponents untexpr = let ListMeasureConOccsWithNonZeroExponents g eraseAbbrevs untexpr = let rec gather acc unt = match (if eraseAbbrevs then stripUnitEqnsFromMeasure unt else stripUnitEqns unt) with - | Measure.Con c -> + | Measure.Const c -> if List.exists (fun (cR, _) -> tyconRefEq g c cR) acc then acc else let e = MeasureExprConExponent g eraseAbbrevs c untexpr if e = ZeroRational then acc else (c, e) :: acc @@ -526,7 +526,7 @@ let ListMeasureConOccsWithNonZeroExponents g eraseAbbrevs untexpr = let ListMeasureConOccsAfterRemapping g r unt = let rec gather acc unt = match stripUnitEqnsFromMeasure unt with - | Measure.Con c -> if List.exists (tyconRefEq g (r c)) acc then acc else r c :: acc + | Measure.Const c -> if List.exists (tyconRefEq g (r c)) acc then acc else r c :: acc | Measure.Prod(unt1, unt2) -> gather (gather acc unt1) unt2 | Measure.RationalPower(untR, _) -> gather acc untR | Measure.Inv untR -> gather acc untR @@ -552,8 +552,8 @@ let ProdMeasures ms = | [] -> Measure.One | m :: ms -> List.foldBack MeasureProdOpt ms m -let isDimensionless g tyarg = - match stripTyparEqns tyarg with +let isDimensionless g ty = + match stripTyparEqns ty with | TType_measure unt -> isNil (ListMeasureVarOccsWithNonZeroExponents unt) && isNil (ListMeasureConOccsWithNonZeroExponents g true unt) @@ -581,7 +581,7 @@ let normalizeMeasure g ms = match vs, cs with | [], [] -> Measure.One | [(v, e)], [] when e = OneRational -> Measure.Var v - | vs, cs -> List.foldBack (fun (v, e) -> fun m -> Measure.Prod (Measure.RationalPower (Measure.Var v, e), m)) vs (List.foldBack (fun (c, e) -> fun m -> Measure.Prod (Measure.RationalPower (Measure.Con c, e), m)) cs Measure.One) + | vs, cs -> List.foldBack (fun (v, e) -> fun m -> Measure.Prod (Measure.RationalPower (Measure.Var v, e), m)) vs (List.foldBack (fun (c, e) -> fun m -> Measure.Prod (Measure.RationalPower (Measure.Const c, e), m)) cs Measure.One) let tryNormalizeMeasureInType g ty = match ty with @@ -789,8 +789,8 @@ let rec stripTyEqnsAndErase eraseFuncAndTuple (g: TcGlobals) ty = else ty - | TType_fun(a, b, flags) when eraseFuncAndTuple -> - TType_app(g.fastFunc_tcr, [ a; b ], flags) + | TType_fun(domainTy, rangeTy, flags) when eraseFuncAndTuple -> + TType_app(g.fastFunc_tcr, [ domainTy; rangeTy ], flags) | TType_tuple(tupInfo, l) when eraseFuncAndTuple -> mkCompiledTupleTy g (evalTupInfoIsStruct tupInfo) l @@ -816,7 +816,7 @@ let rec stripExnEqns (eref: TyconRef) = let primDestForallTy g ty = ty |> stripTyEqns g |> (function TType_forall (tyvs, tau) -> (tyvs, tau) | _ -> failwith "primDestForallTy: not a forall type") -let destFunTy g ty = ty |> stripTyEqns g |> (function TType_fun (tyv, tau, _) -> (tyv, tau) | _ -> failwith "destFunTy: not a function type") +let destFunTy g ty = ty |> stripTyEqns g |> (function TType_fun (domainTy, rangeTy, _) -> (domainTy, rangeTy) | _ -> failwith "destFunTy: not a function type") let destAnyTupleTy g ty = ty |> stripTyEqns g |> (function TType_tuple (tupInfo, l) -> tupInfo, l | _ -> failwith "destAnyTupleTy: not a tuple type") @@ -880,7 +880,7 @@ let argsOfAppTy g ty = ty |> stripTyEqns g |> (function TType_app(_, tinst, _) - let tryDestTyparTy g ty = ty |> stripTyEqns g |> (function TType_var (v, _) -> ValueSome v | _ -> ValueNone) -let tryDestFunTy g ty = ty |> stripTyEqns g |> (function TType_fun (tyv, tau, _) -> ValueSome(tyv, tau) | _ -> ValueNone) +let tryDestFunTy g ty = ty |> stripTyEqns g |> (function TType_fun (domainTy, rangeTy, _) -> ValueSome(domainTy, rangeTy) | _ -> ValueNone) let tryTcrefOfAppTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _, _) -> ValueSome tcref | _ -> ValueNone) @@ -900,14 +900,14 @@ let tryNiceEntityRefOfTy ty = let ty = stripTyparEqnsAux false ty match ty with | TType_app (tcref, _, _) -> ValueSome tcref - | TType_measure (Measure.Con tcref) -> ValueSome tcref + | TType_measure (Measure.Const tcref) -> ValueSome tcref | _ -> ValueNone let tryNiceEntityRefOfTyOption ty = let ty = stripTyparEqnsAux false ty match ty with | TType_app (tcref, _, _) -> Some tcref - | TType_measure (Measure.Con tcref) -> Some tcref + | TType_measure (Measure.Const tcref) -> Some tcref | _ -> None let mkInstForAppTy g ty = @@ -931,12 +931,12 @@ let convertToTypeWithMetadataIfPossible g ty = // TType modifications //--------------------------------------------------------------------------- -let stripMeasuresFromTType g tt = - match tt with - | TType_app(a, b, flags) -> - let bR = b |> List.filter (isMeasureTy g >> not) - TType_app(a, bR, flags) - | _ -> tt +let stripMeasuresFromTy g ty = + match ty with + | TType_app(tcref, tinst, flags) -> + let tinstR = tinst |> List.filter (isMeasureTy g >> not) + TType_app(tcref, tinstR, flags) + | _ -> ty //--------------------------------------------------------------------------- // Equivalence of types up to alpha-equivalence @@ -990,30 +990,29 @@ and traitKeysAEquivAux erasureFlag g aenv witnessInfo1 witnessInfo2 = and returnTypesAEquivAux erasureFlag g aenv retTy retTy2 = match retTy, retTy2 with | None, None -> true - | Some t1, Some t2 -> typeAEquivAux erasureFlag g aenv t1 t2 + | Some ty1, Some ty2 -> typeAEquivAux erasureFlag g aenv ty1 ty2 | _ -> false - and typarConstraintsAEquivAux erasureFlag g aenv tpc1 tpc2 = match tpc1, tpc2 with - | TyparConstraint.CoercesTo(acty, _), - TyparConstraint.CoercesTo(fcty, _) -> - typeAEquivAux erasureFlag g aenv acty fcty + | TyparConstraint.CoercesTo(tgtTy1, _), + TyparConstraint.CoercesTo(tgtTy2, _) -> + typeAEquivAux erasureFlag g aenv tgtTy1 tgtTy2 | TyparConstraint.MayResolveMember(trait1, _), TyparConstraint.MayResolveMember(trait2, _) -> traitsAEquivAux erasureFlag g aenv trait1 trait2 - | TyparConstraint.DefaultsTo(_, acty, _), - TyparConstraint.DefaultsTo(_, fcty, _) -> - typeAEquivAux erasureFlag g aenv acty fcty + | TyparConstraint.DefaultsTo(_, dfltTy1, _), + TyparConstraint.DefaultsTo(_, dfltTy2, _) -> + typeAEquivAux erasureFlag g aenv dfltTy1 dfltTy2 - | TyparConstraint.IsEnum(uty1, _), TyparConstraint.IsEnum(uty2, _) -> - typeAEquivAux erasureFlag g aenv uty1 uty2 + | TyparConstraint.IsEnum(underlyingTy1, _), TyparConstraint.IsEnum(underlyingTy2, _) -> + typeAEquivAux erasureFlag g aenv underlyingTy1 underlyingTy2 - | TyparConstraint.IsDelegate(aty1, bty1, _), TyparConstraint.IsDelegate(aty2, bty2, _) -> - typeAEquivAux erasureFlag g aenv aty1 aty2 && - typeAEquivAux erasureFlag g aenv bty1 bty2 + | TyparConstraint.IsDelegate(argTys1, retTy1, _), TyparConstraint.IsDelegate(argTys2, retTy2, _) -> + typeAEquivAux erasureFlag g aenv argTys1 argTys2 && + typeAEquivAux erasureFlag g aenv retTy1 retTy2 | TyparConstraint.SimpleChoice (tys1, _), TyparConstraint.SimpleChoice(tys2, _) -> ListSet.equals (typeAEquivAux erasureFlag g aenv) tys1 tys2 @@ -1036,9 +1035,9 @@ and typarsAEquivAux erasureFlag g (aenv: TypeEquivEnv) tps1 tps2 = let aenv = aenv.BindEquivTypars tps1 tps2 List.forall2 (typarConstraintSetsAEquivAux erasureFlag g aenv) tps1 tps2 -and tcrefAEquiv g aenv tc1 tc2 = - tyconRefEq g tc1 tc2 || - (match aenv.EquivTycons.TryFind tc1 with Some v -> tyconRefEq g v tc2 | None -> false) +and tcrefAEquiv g aenv tcref1 tcref2 = + tyconRefEq g tcref1 tcref2 || + (match aenv.EquivTycons.TryFind tcref1 with Some v -> tyconRefEq g v tcref2 | None -> false) and typeAEquivAux erasureFlag g aenv ty1 ty2 = let ty1 = stripTyEqnsWrtErasure erasureFlag g ty1 @@ -1052,27 +1051,27 @@ and typeAEquivAux erasureFlag g aenv ty1 ty2 = | TType_var (tp1, _), _ -> match aenv.EquivTypars.TryFind tp1 with - | Some v -> typeEquivAux erasureFlag g v ty2 + | Some tpTy1 -> typeEquivAux erasureFlag g tpTy1 ty2 | None -> false - | TType_app (tc1, b1, _), TType_app (tc2, b2, _) -> - tcrefAEquiv g aenv tc1 tc2 && - typesAEquivAux erasureFlag g aenv b1 b2 + | TType_app (tcref1, tinst1, _), TType_app (tcref2, tinst2, _) -> + tcrefAEquiv g aenv tcref1 tcref2 && + typesAEquivAux erasureFlag g aenv tinst1 tinst2 - | TType_ucase (UnionCaseRef(tc1, n1), b1), TType_ucase (UnionCaseRef(tc2, n2), b2) -> - n1=n2 && - tcrefAEquiv g aenv tc1 tc2 && - typesAEquivAux erasureFlag g aenv b1 b2 + | TType_ucase (UnionCaseRef(tcref1, ucase1), tinst1), TType_ucase (UnionCaseRef(tcref2, ucase2), tinst2) -> + ucase1=ucase2 && + tcrefAEquiv g aenv tcref1 tcref2 && + typesAEquivAux erasureFlag g aenv tinst1 tinst2 - | TType_tuple (s1, l1), TType_tuple (s2, l2) -> - structnessAEquiv s1 s2 && typesAEquivAux erasureFlag g aenv l1 l2 + | TType_tuple (tupInfo1, l1), TType_tuple (tupInfo2, l2) -> + structnessAEquiv tupInfo1 tupInfo2 && typesAEquivAux erasureFlag g aenv l1 l2 | TType_anon (anonInfo1, l1), TType_anon (anonInfo2, l2) -> anonInfoEquiv anonInfo1 anonInfo2 && typesAEquivAux erasureFlag g aenv l1 l2 - | TType_fun (dtys1, rty1, _), TType_fun (dtys2, retTy2, _) -> - typeAEquivAux erasureFlag g aenv dtys1 dtys2 && typeAEquivAux erasureFlag g aenv rty1 retTy2 + | TType_fun (domainTy1, rangeTy1, _), TType_fun (domainTy2, rangeTy2, _) -> + typeAEquivAux erasureFlag g aenv domainTy1 domainTy2 && typeAEquivAux erasureFlag g aenv rangeTy1 rangeTy2 | TType_measure m1, TType_measure m2 -> match erasureFlag with @@ -1081,7 +1080,6 @@ and typeAEquivAux erasureFlag g aenv ty1 ty2 = | _ -> false - and anonInfoEquiv (anonInfo1: AnonRecdTypeInfo) (anonInfo2: AnonRecdTypeInfo) = ccuEq anonInfo1.Assembly anonInfo2.Assembly && structnessAEquiv anonInfo1.TupInfo anonInfo2.TupInfo && @@ -1094,7 +1092,7 @@ and structnessAEquiv un1 un2 = and measureAEquiv g aenv un1 un2 = let vars1 = ListMeasureVarOccs un1 let trans tp1 = if aenv.EquivTypars.ContainsKey tp1 then destAnyParTy g aenv.EquivTypars[tp1] else tp1 - let remapTyconRef tc = if aenv.EquivTycons.ContainsKey tc then aenv.EquivTycons[tc] else tc + let remapTyconRef tcref = if aenv.EquivTycons.ContainsKey tcref then aenv.EquivTycons[tcref] else tcref let vars1R = List.map trans vars1 let vars2 = ListSet.subtract typarEq (ListMeasureVarOccs un2) vars1R let cons1 = ListMeasureConOccsAfterRemapping g remapTyconRef un1 @@ -1161,7 +1159,9 @@ let rec getErasedTypes g ty = //--------------------------------------------------------------------------- let valOrder = { new IComparer with member _.Compare(v1, v2) = compare v1.Stamp v2.Stamp } -let tyconOrder = { new IComparer with member _.Compare(tc1, tc2) = compare tc1.Stamp tc2.Stamp } + +let tyconOrder = { new IComparer with member _.Compare(tycon1, tycon2) = compare tycon1.Stamp tycon2.Stamp } + let recdFieldRefOrder = { new IComparer with member _.Compare(RecdFieldRef(tcref1, nm1), RecdFieldRef(tcref2, nm2)) = @@ -1180,8 +1180,8 @@ let unionCaseRefOrder = // Make some common types //--------------------------------------------------------------------------- -let mkFunTy (g: TcGlobals) d r = - TType_fun (d, r, g.knownWithoutNull) +let mkFunTy (g: TcGlobals) domainTy rangeTy = + TType_fun (domainTy, rangeTy, g.knownWithoutNull) let mkForallTy d r = TType_forall (d, r) @@ -1396,7 +1396,7 @@ let NormalizeDeclaredTyparsForEquiRecursiveInference g tps = type GeneralizedType = GeneralizedType of Typars * TType let mkGenericBindRhs g m generalizedTyparsForRecursiveBlock typeScheme bodyExpr = - let (GeneralizedType(generalizedTypars, tauType)) = typeScheme + let (GeneralizedType(generalizedTypars, tauTy)) = typeScheme // Normalize the generalized typars let generalizedTypars = NormalizeDeclaredTyparsForEquiRecursiveInference g generalizedTypars @@ -1414,7 +1414,7 @@ let mkGenericBindRhs g m generalizedTyparsForRecursiveBlock typeScheme bodyExpr // We record an expression node that indicates that a free choice can be made // for these. This expression node effectively binds the type variables. let freeChoiceTypars = ListSet.subtract typarEq generalizedTyparsForRecursiveBlock generalizedTypars - mkTypeLambda m generalizedTypars (mkTypeChoose m freeChoiceTypars bodyExpr, tauType) + mkTypeLambda m generalizedTypars (mkTypeChoose m freeChoiceTypars bodyExpr, tauTy) let isBeingGeneralized tp typeScheme = let (GeneralizedType(generalizedTypars, _)) = typeScheme @@ -1512,36 +1512,36 @@ let mkExnCaseFieldGet (e1, ecref, j, m) = let mkExnCaseFieldSet (e1, ecref, j, e2, m) = Expr.Op (TOp.ExnFieldSet (ecref, j), [], [e1;e2], m) -let mkDummyLambda (g: TcGlobals) (e: Expr, ety) = - let m = e.Range - mkLambda m (fst (mkCompGenLocal m "unitVar" g.unit_ty)) (e, ety) +let mkDummyLambda (g: TcGlobals) (bodyExpr: Expr, bodyExprTy) = + let m = bodyExpr.Range + mkLambda m (fst (mkCompGenLocal m "unitVar" g.unit_ty)) (bodyExpr, bodyExprTy) -let mkWhile (g: TcGlobals) (spWhile, marker, e1, e2, m) = - Expr.Op (TOp.While (spWhile, marker), [], [mkDummyLambda g (e1, g.bool_ty);mkDummyLambda g (e2, g.unit_ty)], m) +let mkWhile (g: TcGlobals) (spWhile, marker, guardExpr, bodyExpr, m) = + Expr.Op (TOp.While (spWhile, marker), [], [mkDummyLambda g (guardExpr, g.bool_ty);mkDummyLambda g (bodyExpr, g.unit_ty)], m) -let mkIntegerForLoop (g: TcGlobals) (spFor, spIn, v, e1, dir, e2, e3: Expr, m) = - Expr.Op (TOp.IntegerForLoop (spFor, spIn, dir), [], [mkDummyLambda g (e1, g.int_ty) ;mkDummyLambda g (e2, g.int_ty);mkLambda e3.Range v (e3, g.unit_ty)], m) +let mkIntegerForLoop (g: TcGlobals) (spFor, spIn, v, startExpr, dir, finishExpr, bodyExpr: Expr, m) = + Expr.Op (TOp.IntegerForLoop (spFor, spIn, dir), [], [mkDummyLambda g (startExpr, g.int_ty) ;mkDummyLambda g (finishExpr, g.int_ty);mkLambda bodyExpr.Range v (bodyExpr, g.unit_ty)], m) -let mkTryWith g (e1, vf, ef: Expr, vh, eh: Expr, m, ty, spTry, spWith) = - Expr.Op (TOp.TryWith (spTry, spWith), [ty], [mkDummyLambda g (e1, ty);mkLambda ef.Range vf (ef, ty);mkLambda eh.Range vh (eh, ty)], m) +let mkTryWith g (bodyExpr, filterVal, filterExpr: Expr, handlerVal, handlerExpr: Expr, m, ty, spTry, spWith) = + Expr.Op (TOp.TryWith (spTry, spWith), [ty], [mkDummyLambda g (bodyExpr, ty);mkLambda filterExpr.Range filterVal (filterExpr, ty);mkLambda handlerExpr.Range handlerVal (handlerExpr, ty)], m) -let mkTryFinally (g: TcGlobals) (e1, e2, m, ty, spTry, spFinally) = - Expr.Op (TOp.TryFinally (spTry, spFinally), [ty], [mkDummyLambda g (e1, ty);mkDummyLambda g (e2, g.unit_ty)], m) +let mkTryFinally (g: TcGlobals) (bodyExpr, finallyExpr, m, ty, spTry, spFinally) = + Expr.Op (TOp.TryFinally (spTry, spFinally), [ty], [mkDummyLambda g (bodyExpr, ty);mkDummyLambda g (finallyExpr, g.unit_ty)], m) let mkDefault (m, ty) = Expr.Const (Const.Zero, m, ty) -let mkValSet m v e = - Expr.Op (TOp.LValueOp (LSet, v), [], [e], m) +let mkValSet m vref e = + Expr.Op (TOp.LValueOp (LSet, vref), [], [e], m) -let mkAddrSet m v e = - Expr.Op (TOp.LValueOp (LByrefSet, v), [], [e], m) +let mkAddrSet m vref e = + Expr.Op (TOp.LValueOp (LByrefSet, vref), [], [e], m) -let mkAddrGet m v = - Expr.Op (TOp.LValueOp (LByrefGet, v), [], [], m) +let mkAddrGet m vref = + Expr.Op (TOp.LValueOp (LByrefGet, vref), [], [], m) -let mkValAddr m readonly v = - Expr.Op (TOp.LValueOp (LAddrOf readonly, v), [], [], m) +let mkValAddr m readonly vref = + Expr.Op (TOp.LValueOp (LAddrOf readonly, vref), [], [], m) //-------------------------------------------------------------------------- // Maps tracking extra information for values @@ -1682,9 +1682,9 @@ let tryDestForallTy g ty = let rec stripFunTy g ty = if isFunTy g ty then - let d, r = destFunTy g ty - let more, rty = stripFunTy g r - d :: more, rty + let domainTy, rangeTy = destFunTy g ty + let more, retTy = stripFunTy g rangeTy + domainTy :: more, retTy else [], ty let applyForallTy g ty tyargs = @@ -1696,23 +1696,24 @@ let reduceIteratedFunTy g ty args = if not (isFunTy g ty) then failwith "reduceIteratedFunTy" snd (destFunTy g ty)) ty args -let applyTyArgs g functy tyargs = - if isForallTy g functy then applyForallTy g functy tyargs else functy +let applyTyArgs g ty tyargs = + if isForallTy g ty then applyForallTy g ty tyargs else ty -let applyTys g functy (tyargs, argTys) = - let afterTyappTy = applyTyArgs g functy tyargs +let applyTys g funcTy (tyargs, argTys) = + let afterTyappTy = applyTyArgs g funcTy tyargs reduceIteratedFunTy g afterTyappTy argTys -let formalApplyTys g functy (tyargs, args) = +let formalApplyTys g funcTy (tyargs, args) = reduceIteratedFunTy g - (if isNil tyargs then functy else snd (destForallTy g functy)) + (if isNil tyargs then funcTy else snd (destForallTy g funcTy)) args let rec stripFunTyN g n ty = assert (n >= 0) if n > 0 && isFunTy g ty then let d, r = destFunTy g ty - let more, rty = stripFunTyN g (n-1) r in d :: more, rty + let more, retTy = stripFunTyN g (n-1) r + d :: more, retTy else [], ty let tryDestAnyTupleTy g ty = @@ -1796,10 +1797,10 @@ let destListTy (g: TcGlobals) ty = | ValueSome (tcref, [ty]) when tyconRefEq g tcref g.list_tcr_canon -> ty | _ -> failwith "destListTy" -let tyconRefEqOpt g tcOpt tc = - match tcOpt with +let tyconRefEqOpt g tcrefOpt tcref = + match tcrefOpt with | None -> false - | Some tc2 -> tyconRefEq g tc2 tc + | Some tcref2 -> tyconRefEq g tcref2 tcref let isStringTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _, _) -> tyconRefEq g tcref g.system_String_tcref | _ -> false) @@ -1830,13 +1831,13 @@ let isByrefTy g ty = let isInByrefTag g ty = ty |> stripTyEqns g |> (function TType_app(tcref, [], _) -> tyconRefEq g g.byrefkind_In_tcr tcref | _ -> false) let isInByrefTy g ty = ty |> stripTyEqns g |> (function - | TType_app(tcref, [_; tag], _) when g.byref2_tcr.CanDeref -> tyconRefEq g g.byref2_tcr tcref && isInByrefTag g tag + | TType_app(tcref, [_; tagTy], _) when g.byref2_tcr.CanDeref -> tyconRefEq g g.byref2_tcr tcref && isInByrefTag g tagTy | _ -> false) let isOutByrefTag g ty = ty |> stripTyEqns g |> (function TType_app(tcref, [], _) -> tyconRefEq g g.byrefkind_Out_tcr tcref | _ -> false) let isOutByrefTy g ty = ty |> stripTyEqns g |> (function - | TType_app(tcref, [_; tag], _) when g.byref2_tcr.CanDeref -> tyconRefEq g g.byref2_tcr tcref && isOutByrefTag g tag + | TType_app(tcref, [_; tagTy], _) when g.byref2_tcr.CanDeref -> tyconRefEq g g.byref2_tcr tcref && isOutByrefTag g tagTy | _ -> false) #if !NO_TYPEPROVIDERS @@ -2059,7 +2060,7 @@ let MemberIsExplicitImpl g (membInfo: ValMemberInfo) = membInfo.MemberFlags.IsOverrideOrExplicitImpl && match membInfo.ImplementedSlotSigs with | [] -> false - | slotsigs -> slotsigs |> List.forall (fun slotsig -> isInterfaceTy g slotsig.ImplementedType) + | slotsigs -> slotsigs |> List.forall (fun slotsig -> isInterfaceTy g slotsig.DeclaringType) let ValIsExplicitImpl g (v: Val) = match v.MemberInfo with @@ -2239,8 +2240,8 @@ and accFreeInTyparConstraint opts tpc acc = | TyparConstraint.MayResolveMember (traitInfo, _) -> accFreeInTrait opts traitInfo acc | TyparConstraint.DefaultsTo(_, defaultTy, _) -> accFreeInType opts defaultTy acc | TyparConstraint.SimpleChoice(tys, _) -> accFreeInTypes opts tys acc - | TyparConstraint.IsEnum(uty, _) -> accFreeInType opts uty acc - | TyparConstraint.IsDelegate(aty, bty, _) -> accFreeInType opts aty (accFreeInType opts bty acc) + | TyparConstraint.IsEnum(underlyingTy, _) -> accFreeInType opts underlyingTy acc + | TyparConstraint.IsDelegate(argTys, retTy, _) -> accFreeInType opts argTys (accFreeInType opts retTy acc) | TyparConstraint.SupportsComparison _ | TyparConstraint.SupportsEquality _ | TyparConstraint.SupportsNull _ @@ -2302,18 +2303,18 @@ and accFreeInType opts ty acc = | TType_anon (anonInfo, l) -> accFreeInTypes opts l (accFreeInTupInfo opts anonInfo.TupInfo acc) - | TType_app (tc, tinst, _) -> - let acc = accFreeTycon opts tc acc + | TType_app (tcref, tinst, _) -> + let acc = accFreeTycon opts tcref acc match tinst with | [] -> acc // optimization to avoid unneeded call | [h] -> accFreeInType opts h acc // optimization to avoid unneeded call | _ -> accFreeInTypes opts tinst acc - | TType_ucase (UnionCaseRef(tc, _), tinst) -> - accFreeInTypes opts tinst (accFreeTycon opts tc acc) + | TType_ucase (UnionCaseRef(tcref, _), tinst) -> + accFreeInTypes opts tinst (accFreeTycon opts tcref acc) - | TType_fun (d, r, _) -> - accFreeInType opts d (accFreeInType opts r acc) + | TType_fun (domainTy, rangeTy, _) -> + accFreeInType opts domainTy (accFreeInType opts rangeTy acc) | TType_var (r, _) -> accFreeTyparRef opts r acc @@ -2375,10 +2376,10 @@ and accFreeInTyparConstraintLeftToRight g cxFlag thruFlag acc tpc = accFreeInTypeLeftToRight g cxFlag thruFlag acc defaultTy | TyparConstraint.SimpleChoice(tys, _) -> accFreeInTypesLeftToRight g cxFlag thruFlag acc tys - | TyparConstraint.IsEnum(uty, _) -> - accFreeInTypeLeftToRight g cxFlag thruFlag acc uty - | TyparConstraint.IsDelegate(aty, bty, _) -> - accFreeInTypeLeftToRight g cxFlag thruFlag (accFreeInTypeLeftToRight g cxFlag thruFlag acc aty) bty + | TyparConstraint.IsEnum(underlyingTy, _) -> + accFreeInTypeLeftToRight g cxFlag thruFlag acc underlyingTy + | TyparConstraint.IsDelegate(argTys, retTy, _) -> + accFreeInTypeLeftToRight g cxFlag thruFlag (accFreeInTypeLeftToRight g cxFlag thruFlag acc argTys) retTy | TyparConstraint.SupportsComparison _ | TyparConstraint.SupportsEquality _ | TyparConstraint.SupportsNull _ @@ -2419,9 +2420,9 @@ and accFreeInTypeLeftToRight g cxFlag thruFlag acc ty = | TType_ucase (_, tinst) -> accFreeInTypesLeftToRight g cxFlag thruFlag acc tinst - | TType_fun (d, r, _) -> - let dacc = accFreeInTypeLeftToRight g cxFlag thruFlag acc d - accFreeInTypeLeftToRight g cxFlag thruFlag dacc r + | TType_fun (domainTy, rangeTy, _) -> + let dacc = accFreeInTypeLeftToRight g cxFlag thruFlag acc domainTy + accFreeInTypeLeftToRight g cxFlag thruFlag dacc rangeTy | TType_var (r, _) -> accFreeTyparRefLeftToRight g cxFlag thruFlag acc r @@ -2546,12 +2547,12 @@ let GetMemberTypeInMemberForm g memberFlags valReprInfo numEnclosingTypars ty m let paramArgInfos = match paramArgInfos, valReprInfo.ArgInfos with // static member and module value unit argument elimination - | [[(argType, _)]], [[]] -> - assert isUnitTy g argType + | [[(argTy, _)]], [[]] -> + assert isUnitTy g argTy [[]] // instance member unit argument elimination - | [[(argType, _)]], [[_objArg];[]] -> - assert isUnitTy g argType + | [[(argTy, _)]], [[_objArg];[]] -> + assert isUnitTy g argTy [[]] | _ -> paramArgInfos @@ -2770,10 +2771,10 @@ module PrettyTypes = let niceTypars, renaming = NewPrettyTypars [] ftps names // strip universal types for printing - let getTauStayTau t = - match t with + let getTauStayTau ty = + match ty with | TType_forall (_, tau) -> tau - | _ -> t + | _ -> ty let tauThings = mapTys getTauStayTau things let prettyThings = mapTys (instType renaming) tauThings @@ -2858,8 +2859,8 @@ module SimplifyTypes = let ty = stripTyparEqns ty let z = f z ty match ty with - | TType_forall (_, body) -> - foldTypeButNotConstraints f z body + | TType_forall (_, bodyTy) -> + foldTypeButNotConstraints f z bodyTy | TType_app (_, tys, _) | TType_ucase (_, tys) @@ -2867,8 +2868,8 @@ module SimplifyTypes = | TType_tuple (_, tys) -> List.fold (foldTypeButNotConstraints f) z tys - | TType_fun (s, t, _) -> - foldTypeButNotConstraints f (foldTypeButNotConstraints f z s) t + | TType_fun (domainTy, rangeTy, _) -> + foldTypeButNotConstraints f (foldTypeButNotConstraints f z domainTy) rangeTy | TType_var _ -> z @@ -3184,7 +3185,7 @@ let tyconRefToFullName (tcref:TyconRef) = seq { yield! namespaceParts; yield tcref.DisplayName } |> String.concat "." let rec qualifiedInterfaceImplementationNameAux g (x:TType) : string = - match stripMeasuresFromTType g (stripTyEqnsAndErase true g x) with + match stripMeasuresFromTy g (stripTyEqnsAndErase true g x) with | TType_app (a, [], _) -> tyconRefToFullName a @@ -3203,8 +3204,8 @@ let rec qualifiedInterfaceImplementationNameAux g (x:TType) : string = failwithf "unexpected: expected TType_app but got %O" (x.GetType()) /// for types in the global namespace, `global is prepended (note the backtick) -let qualifiedInterfaceImplementationName g (tt:TType) memberName = - let interfaceName = tt |> qualifiedInterfaceImplementationNameAux g +let qualifiedInterfaceImplementationName g (ty: TType) memberName = + let interfaceName = ty |> qualifiedInterfaceImplementationNameAux g sprintf "%s.%s" interfaceName memberName let qualifiedMangledNameOfTyconRef tcref nm = @@ -4951,7 +4952,7 @@ and accFreeInTest (opts: FreeVarOptions) discrim acc = | DecisionTreeTest.ArrayLength(_, ty) -> accFreeVarsInTy opts ty acc | DecisionTreeTest.Const _ | DecisionTreeTest.IsNull -> acc - | DecisionTreeTest.IsInst (srcty, tgty) -> accFreeVarsInTy opts srcty (accFreeVarsInTy opts tgty acc) + | DecisionTreeTest.IsInst (srcTy, tgtTy) -> accFreeVarsInTy opts srcTy (accFreeVarsInTy opts tgtTy acc) | DecisionTreeTest.ActivePatternCase (exp, tys, _, activePatIdentity, _, _) -> accFreeInExpr opts exp (accFreeVarsInTys opts tys @@ -5826,7 +5827,7 @@ and remapDecisionTree ctxt compgen tmenv x = | DecisionTreeTest.UnionCase (uc, tinst) -> DecisionTreeTest.UnionCase(remapUnionCaseRef tmenv.tyconRefRemap uc, remapTypes tmenv tinst) | DecisionTreeTest.ArrayLength (n, ty) -> DecisionTreeTest.ArrayLength(n, remapType tmenv ty) | DecisionTreeTest.Const _ -> test - | DecisionTreeTest.IsInst (srcty, tgty) -> DecisionTreeTest.IsInst (remapType tmenv srcty, remapType tmenv tgty) + | DecisionTreeTest.IsInst (srcTy, tgtTy) -> DecisionTreeTest.IsInst (remapType tmenv srcTy, remapType tmenv tgtTy) | DecisionTreeTest.IsNull -> DecisionTreeTest.IsNull | DecisionTreeTest.ActivePatternCase _ -> failwith "DecisionTreeTest.ActivePatternCase should only be used during pattern match compilation" | DecisionTreeTest.Error(m) -> DecisionTreeTest.Error(m) @@ -8597,8 +8598,8 @@ let rec typeEnc g (gtpsType, gtpsMethod) ty = else sprintf "System.Tuple%s"(tyargsEnc g (gtpsType, gtpsMethod) tys) - | TType_fun (f, x, _) -> - "Microsoft.FSharp.Core.FSharpFunc" + tyargsEnc g (gtpsType, gtpsMethod) [f;x] + | TType_fun (domainTy, rangeTy, _) -> + "Microsoft.FSharp.Core.FSharpFunc" + tyargsEnc g (gtpsType, gtpsMethod) [domainTy; rangeTy] | TType_var (typar, _) -> typarEnc g (gtpsType, gtpsMethod) typar @@ -8869,22 +8870,22 @@ let canUseUnboxFast g m ty = // // No sequence point is generated for this expression form as this function is only // used for compiler-generated code. -let mkIsInstConditional g m tgty vinputExpr v e2 e3 = +let mkIsInstConditional g m tgtTy vinputExpr v e2 e3 = - if canUseTypeTestFast g tgty && isRefTy g tgty then + if canUseTypeTestFast g tgtTy && isRefTy g tgtTy then let mbuilder = MatchBuilder(DebugPointAtBinding.NoneAtInvisible, m) let tg2 = mbuilder.AddResultTarget(e2) let tg3 = mbuilder.AddResultTarget(e3) let dtree = TDSwitch(exprForVal m v, [TCase(DecisionTreeTest.IsNull, tg3)], Some tg2, m) let expr = mbuilder.Close(dtree, m, tyOfExpr g e2) - mkCompGenLet m v (mkIsInst tgty vinputExpr m) expr + mkCompGenLet m v (mkIsInst tgtTy vinputExpr m) expr else let mbuilder = MatchBuilder(DebugPointAtBinding.NoneAtInvisible, m) - let tg2 = TDSuccess([mkCallUnbox g m tgty vinputExpr], mbuilder.AddTarget(TTarget([v], e2, None))) + let tg2 = TDSuccess([mkCallUnbox g m tgtTy vinputExpr], mbuilder.AddTarget(TTarget([v], e2, None))) let tg3 = mbuilder.AddResultTarget(e3) - let dtree = TDSwitch(vinputExpr, [TCase(DecisionTreeTest.IsInst(tyOfExpr g vinputExpr, tgty), tg2)], Some tg3, m) + let dtree = TDSwitch(vinputExpr, [TCase(DecisionTreeTest.IsInst(tyOfExpr g vinputExpr, tgtTy), tg2)], Some tg3, m) let expr = mbuilder.Close(dtree, m, tyOfExpr g e2) expr @@ -10114,7 +10115,7 @@ let (|ResumableCodeInvoke|_|) g expr = let ComputeUseMethodImpl g (v: Val) = v.ImplementedSlotSigs |> List.exists (fun slotsig -> - let oty = slotsig.ImplementedType + let oty = slotsig.DeclaringType let otcref = tcrefOfAppTy g oty let tcref = v.MemberApparentEntity diff --git a/src/Compiler/TypedTree/TypedTreeOps.fsi b/src/Compiler/TypedTree/TypedTreeOps.fsi index 1a89375f930..5d27bff7fbc 100755 --- a/src/Compiler/TypedTree/TypedTreeOps.fsi +++ b/src/Compiler/TypedTree/TypedTreeOps.fsi @@ -845,7 +845,7 @@ val isDimensionless: TcGlobals -> TType -> bool // TType modifications and comparisons //--------------------------------------------------------------------------- -val stripMeasuresFromTType: TcGlobals -> TType -> TType +val stripMeasuresFromTy: TcGlobals -> TType -> TType //------------------------------------------------------------------------- // Equivalence of types (up to substitution of type variables in the left-hand type) diff --git a/src/Compiler/TypedTree/TypedTreePickle.fs b/src/Compiler/TypedTree/TypedTreePickle.fs index 3f5ba37afde..57c557d2b8a 100644 --- a/src/Compiler/TypedTree/TypedTreePickle.fs +++ b/src/Compiler/TypedTree/TypedTreePickle.fs @@ -1575,7 +1575,7 @@ let p_measure_one = p_byte 4 // Pickle a unit-of-measure variable or constructor let p_measure_varcon unt st = match unt with - | Measure.Con tcref -> p_measure_con tcref st + | Measure.Const tcref -> p_measure_con tcref st | Measure.Var v -> p_measure_var v st | _ -> pfailwith st "p_measure_varcon: expected measure variable or constructor" @@ -1604,7 +1604,7 @@ let rec p_measure_power unt q st = let rec p_normalized_measure unt st = let unt = stripUnitEqnsAux false unt match unt with - | Measure.Con tcref -> p_measure_con tcref st + | Measure.Const tcref -> p_measure_con tcref st | Measure.Inv x -> p_byte 1 st; p_normalized_measure x st | Measure.Prod(x1, x2) -> p_byte 2 st; p_normalized_measure x1 st; p_normalized_measure x2 st | Measure.Var v -> p_measure_var v st @@ -1625,7 +1625,7 @@ let u_rational st = let rec u_measure_expr st = let tag = u_byte st match tag with - | 0 -> let a = u_tcref st in Measure.Con a + | 0 -> let a = u_tcref st in Measure.Const a | 1 -> let a = u_measure_expr st in Measure.Inv a | 2 -> let a, b = u_tup2 u_measure_expr u_measure_expr st in Measure.Prod (a, b) | 3 -> let a = u_tpref st in Measure.Var a @@ -2437,7 +2437,7 @@ and p_dtree_discrim x st = | DecisionTreeTest.UnionCase (ucref, tinst) -> p_byte 0 st; p_tup2 p_ucref p_tys (ucref, tinst) st | DecisionTreeTest.Const c -> p_byte 1 st; p_const c st | DecisionTreeTest.IsNull -> p_byte 2 st - | DecisionTreeTest.IsInst (srcty, tgty) -> p_byte 3 st; p_ty srcty st; p_ty tgty st + | DecisionTreeTest.IsInst (srcTy, tgtTy) -> p_byte 3 st; p_ty srcTy st; p_ty tgtTy st | DecisionTreeTest.ArrayLength (n, ty) -> p_byte 4 st; p_tup2 p_int p_ty (n, ty) st | DecisionTreeTest.ActivePatternCase _ -> pfailwith st "DecisionTreeTest.ActivePatternCase: only used during pattern match compilation" | DecisionTreeTest.Error _ -> pfailwith st "DecisionTreeTest.Error: only used during pattern match compilation" diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index ebc1d2cb28c..a21e22dc891 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -141,15 +141,15 @@ type BindingSet = BindingSetPreAttrs of range * bool * bool * (SynAttributes -> let mkClassMemberLocalBindings(isStatic, initialRangeOpt, attrs, vis, BindingSetPreAttrs(_, isRec, isUse, declsPreAttrs, bindingSetRange)) = let ignoredFreeAttrs, decls = declsPreAttrs attrs vis - let wholeRange = + let mWhole = match initialRangeOpt with | None -> bindingSetRange | Some m -> unionRanges m bindingSetRange // decls could have a leading attribute |> fun m -> (m, decls) ||> unionRangeWithListBy (fun (SynBinding(range = m)) -> m) - if not (isNil ignoredFreeAttrs) then warning(Error(FSComp.SR.parsAttributesIgnored(), wholeRange)); - if isUse then errorR(Error(FSComp.SR.parsUseBindingsIllegalInImplicitClassConstructors(), wholeRange)) - SynMemberDefn.LetBindings (decls, isStatic, isRec, wholeRange) + if not (isNil ignoredFreeAttrs) then warning(Error(FSComp.SR.parsAttributesIgnored(), mWhole)); + if isUse then errorR(Error(FSComp.SR.parsUseBindingsIllegalInImplicitClassConstructors(), mWhole)) + SynMemberDefn.LetBindings (decls, isStatic, isRec, mWhole) let mkLocalBindings (mWhole, BindingSetPreAttrs(_, isRec, isUse, declsPreAttrs, _), mIn, body: SynExpr) = let ignoredFreeAttrs, decls = declsPreAttrs [] None @@ -830,12 +830,12 @@ moduleSpfn: _xmlDoc.MarkAsInvalid() let attrs = $1 @ cas let xmlDoc = grabXmlDoc(parseState, $1, 1) - let mTc = + let mDefn = (d3, attrs) ||> unionRangeWithListBy (fun (a: SynAttributeList) -> a.Range) |> unionRanges range |> unionRangeWithXmlDoc xmlDoc - let tc = (SynTypeDefnSig(SynComponentInfo(attrs, a, cs, b, xmlDoc, d, d2, d3), equalsRange, typeRepr, withKeyword, members, mTc)) - let m = (mTc, $5) ||> unionRangeWithListBy (fun (a: SynTypeDefnSig) -> a.Range) |> unionRanges (rhs parseState 3) + let tc = SynTypeDefnSig(SynComponentInfo(attrs, a, cs, b, xmlDoc, d, d2, d3), equalsRange, typeRepr, withKeyword, members, mDefn) + let m = (mDefn, $5) ||> unionRangeWithListBy (fun (a: SynTypeDefnSig) -> a.Range) |> unionRanges (rhs parseState 3) SynModuleSigDecl.Types (tc :: $5, m) } | opt_attributes opt_declVisibility exconSpfn @@ -844,8 +844,8 @@ moduleSpfn: let xmlDoc = grabXmlDoc(parseState, $1, 1) let mDefnReprWithAttributes = (d2, $1) ||> unionRangeWithListBy (fun a -> a.Range) |> unionRangeWithXmlDoc xmlDoc let mWhole = (mDefnReprWithAttributes, members) ||> unionRangeWithListBy (fun (m: SynMemberSig) -> m.Range) - let ec = SynExceptionSig(SynExceptionDefnRepr($1@cas, a, b, xmlDoc, d, mDefnReprWithAttributes), withKeyword, members, mWhole) - SynModuleSigDecl.Exception(ec, mWhole) } + let synExnDefn = SynExceptionSig(SynExceptionDefnRepr($1@cas, a, b, xmlDoc, d, mDefnReprWithAttributes), withKeyword, members, mWhole) + SynModuleSigDecl.Exception(synExnDefn, mWhole) } | openDecl { SynModuleSigDecl.Open($1, (rhs parseState 1)) } @@ -901,7 +901,8 @@ tyconSpfnList: | AND tyconSpfn tyconSpfnList { let xmlDoc = grabXmlDoc(parseState, [], 1) let tyconSpfn = - let (SynTypeDefnSig(SynComponentInfo (a, typars, c, lid, _xmlDoc, fixity, vis, rangeOfLid) as componentInfo, equalsRange, typeRepr, withKeyword, members, range)) = $2 + let (SynTypeDefnSig(componentInfo, equalsRange, typeRepr, withKeyword, members, range)) = $2 + let (SynComponentInfo(a, typars, c, lid, _xmlDoc, fixity, vis, mLongId)) = componentInfo if xmlDoc.IsEmpty then if _xmlDoc.IsEmpty then $2 else let range = unionRangeWithXmlDoc _xmlDoc range @@ -910,7 +911,8 @@ tyconSpfnList: else _xmlDoc.MarkAsInvalid() let range = unionRangeWithXmlDoc xmlDoc range - SynTypeDefnSig(SynComponentInfo (a, typars, c, lid, xmlDoc, fixity, vis, rangeOfLid), equalsRange, typeRepr, withKeyword, members, range) + let componentInfo = SynComponentInfo (a, typars, c, lid, xmlDoc, fixity, vis, mLongId) + SynTypeDefnSig(componentInfo, equalsRange, typeRepr, withKeyword, members, range) tyconSpfn :: $3 } | @@ -920,9 +922,9 @@ tyconSpfnList: /* A type definition in a signature */ tyconSpfn: | typeNameInfo EQUALS tyconSpfnRhsBlock - { let lhsm = rhs parseState 1 + { let mLhs = rhs parseState 1 let mEquals = rhs parseState 2 - $3 lhsm $1 (Some mEquals) } + $3 mLhs $1 (Some mEquals) } | typeNameInfo opt_classSpfn { let mWithKwd, members = $2 let (SynComponentInfo(range=range)) = $1 @@ -949,22 +951,22 @@ tyconSpfnRhsBlock: /* representation. */ | OBLOCKBEGIN tyconSpfnRhs opt_OBLOCKSEP classSpfnMembers opt_classSpfn oblockend opt_classSpfn { let m = lhs parseState - (fun lhsm nameInfo mEquals -> + (fun mLhs nameInfo mEquals -> let members = $4 @ (snd $5) - $2 lhsm nameInfo mEquals (checkForMultipleAugmentations m members (snd $7))) } + $2 mLhs nameInfo mEquals (checkForMultipleAugmentations m members (snd $7))) } | tyconSpfnRhs opt_classSpfn { let m = lhs parseState - (fun lhsm nameInfo mEquals -> + (fun mLhs nameInfo mEquals -> let _, members = $2 - $1 lhsm nameInfo mEquals members) } + $1 mLhs nameInfo mEquals members) } /* The right-hand-side of a type definition in a signature */ tyconSpfnRhs: | tyconDefnOrSpfnSimpleRepr - { (fun lhsm nameInfo mEquals augmentation -> - let declRange = unionRanges lhsm $1.Range + { (fun mLhs nameInfo mEquals augmentation -> + let declRange = unionRanges mLhs $1.Range let mWhole = (declRange, augmentation) ||> unionRangeWithListBy (fun (mem: SynMemberSig) -> mem.Range) SynTypeDefnSig(nameInfo, mEquals, SynTypeDefnSigRepr.Simple ($1, $1.Range), None, augmentation, mWhole)) } @@ -1063,7 +1065,7 @@ classMemberSpfn: let isInline, doc, vis2, id, explicitValTyparDecls, (ty, arity), (mEquals, optLiteralValue) = $4, grabXmlDoc(parseState, $1, 1), $5, $6, $7, $9, $11 let mWith, getSetRangeOpt, getSet = $10 let getSetAdjuster arity = match arity, getSet with SynValInfo([], _), SynMemberKind.Member -> SynMemberKind.PropertyGet | _ -> getSet - let wholeRange = + let mWhole = let m = rhs parseState 3 match getSetRangeOpt with | None -> unionRanges m ty.Range @@ -1074,9 +1076,9 @@ classMemberSpfn: match optLiteralValue with | None -> m | Some e -> unionRanges m e.Range - let valSpfn = SynValSig($1, id, explicitValTyparDecls, ty, arity, isInline, false, doc, vis2, optLiteralValue, wholeRange, { ValKeyword = None; WithKeyword = mWith; EqualsRange = mEquals }) + let valSpfn = SynValSig($1, id, explicitValTyparDecls, ty, arity, isInline, false, doc, vis2, optLiteralValue, mWhole, { ValKeyword = None; WithKeyword = mWith; EqualsRange = mEquals }) let _, flags = $3 - SynMemberSig.Member(valSpfn, flags (getSetAdjuster arity), wholeRange) } + SynMemberSig.Member(valSpfn, flags (getSetAdjuster arity), mWhole) } | opt_attributes opt_declVisibility interfaceMember appType { if Option.isSome $2 then errorR(Error(FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier(), rhs parseState 2)) @@ -1087,18 +1089,18 @@ classMemberSpfn: SynMemberSig.Inherit ($4, unionRanges (rhs parseState 3) ($4).Range) } | opt_attributes opt_declVisibility VAL fieldDecl - { let wholeRange = rhs2 parseState 1 4 + { let mWhole = rhs2 parseState 1 4 if Option.isSome $2 then errorR (Error (FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier (), rhs parseState 2)) - let (SynField(_, _, _, _, _, xmlDoc, _, _)) as field = $4 $1 false wholeRange - let wholeRange = unionRangeWithXmlDoc xmlDoc wholeRange - SynMemberSig.ValField (field, wholeRange) } + let (SynField(_, _, _, _, _, xmlDoc, _, _)) as field = $4 $1 false mWhole + let mWhole = unionRangeWithXmlDoc xmlDoc mWhole + SynMemberSig.ValField (field, mWhole) } | opt_attributes opt_declVisibility STATIC VAL fieldDecl - { let wholeRange = rhs2 parseState 1 5 + { let mWhole = rhs2 parseState 1 5 if Option.isSome $2 then errorR (Error (FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier (), rhs parseState 2)) - let (SynField(_, _, _, _, _, xmlDoc, _, _)) as field = $5 $1 true wholeRange - let wholeRange = unionRangeWithXmlDoc xmlDoc wholeRange - SynMemberSig.ValField(field, wholeRange) } + let (SynField(_, _, _, _, _, xmlDoc, _, _)) as field = $5 $1 true mWhole + let mWhole = unionRangeWithXmlDoc xmlDoc mWhole + SynMemberSig.ValField(field, mWhole) } | opt_attributes opt_declVisibility STATIC typeKeyword tyconSpfn { if Option.isSome $2 then errorR(Error(FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier(), rhs parseState 2)) @@ -1374,9 +1376,9 @@ moduleDefn: let (SynTypeDefn(SynComponentInfo(cas, a, cs, b, _xmlDoc, d, d2, d3), e, f, g, h, trivia)) = $4 _xmlDoc.MarkAsInvalid() let attrs = $1@cas - let mTc = (h, attrs) ||> unionRangeWithListBy (fun (a: SynAttributeList) -> a.Range) |> unionRangeWithXmlDoc xmlDoc + let mDefn = (h, attrs) ||> unionRangeWithListBy (fun (a: SynAttributeList) -> a.Range) |> unionRangeWithXmlDoc xmlDoc let mType = rhs parseState 3 - let tc = (SynTypeDefn(SynComponentInfo(attrs, a, cs, b, xmlDoc, d, d2, d3), e, f, g, mTc, { trivia with TypeKeyword = Some mType })) + let tc = SynTypeDefn(SynComponentInfo(attrs, a, cs, b, xmlDoc, d, d2, d3), e, f, g, mDefn, { trivia with TypeKeyword = Some mType }) let types = tc :: $5 [ SynModuleDecl.Types(types, (rhs parseState 3, types) ||> unionRangeWithListBy (fun t -> t.Range) ) ] } @@ -1387,8 +1389,8 @@ moduleDefn: let xmlDoc = grabXmlDoc(parseState, $1, 1) let defnReprRange = (d2, $1) ||> unionRangeWithListBy (fun a -> a.Range) |> unionRangeWithXmlDoc xmlDoc let mWhole = (f, $1) ||> unionRangeWithListBy (fun a -> a.Range) |> unionRangeWithXmlDoc xmlDoc - let ec = (SynExceptionDefn(SynExceptionDefnRepr($1@cas, a, b, xmlDoc, d, defnReprRange), withKeyword, e, mWhole)) - [ SynModuleDecl.Exception(ec, mWhole) ] } + let synExnDefn = SynExceptionDefn(SynExceptionDefnRepr($1@cas, a, b, xmlDoc, d, defnReprRange), withKeyword, e, mWhole) + [ SynModuleDecl.Exception(synExnDefn, mWhole) ] } /* 'module' definitions */ | opt_attributes opt_declVisibility moduleIntro EQUALS namedModuleDefnBlock @@ -1491,7 +1493,7 @@ namedModuleDefnBlock: { Choice1Of2 $1.LongIdent } -/* A module definition that inccludes a 'begin'...'end' (rarely used in F# with #light syntax) */ +/* A module definition that includes a 'begin'...'end' (rarely used in F# with #light syntax) */ wrappedNamedModuleDefn: | structOrBegin moduleDefnsOrExprPossiblyEmpty END { $2 } @@ -1614,7 +1616,8 @@ tyconDefnList: | AND tyconDefn tyconDefnList { let xmlDoc = grabXmlDoc(parseState, [], 1) let tyconDefn = - let (SynTypeDefn(SynComponentInfo (a, typars, c, lid, _xmlDoc, fixity, vis, rangeOfLid) as componentInfo, typeRepr, members, implicitConstructor, range, trivia)) = $2 + let (SynTypeDefn(componentInfo, typeRepr, members, implicitConstructor, range, trivia)) = $2 + let (SynComponentInfo(a, typars, c, lid, _xmlDoc, fixity, vis, mLongId)) = componentInfo if xmlDoc.IsEmpty then if _xmlDoc.IsEmpty then $2 else let range = unionRangeWithXmlDoc _xmlDoc range @@ -1623,7 +1626,8 @@ tyconDefnList: else _xmlDoc.MarkAsInvalid() let range = unionRangeWithXmlDoc xmlDoc range - SynTypeDefn(SynComponentInfo (a, typars, c, lid, xmlDoc, fixity, vis, rangeOfLid), typeRepr, members, implicitConstructor, range, trivia) + let componentInfo = SynComponentInfo (a, typars, c, lid, xmlDoc, fixity, vis, mLongId) + SynTypeDefn(componentInfo, typeRepr, members, implicitConstructor, range, trivia) tyconDefn :: $3 } | { [] } @@ -1910,15 +1914,15 @@ classDefnMember: let isInline, doc, id, explicitValTyparDecls = $4, grabXmlDoc(parseState, $1, 1), $5, $6 let mWith, getSetRangeOpt, getSet = $9 let getSetAdjuster arity = match arity, getSet with SynValInfo([], _), SynMemberKind.Member -> SynMemberKind.PropertyGet | _ -> getSet - let wholeRange = + let mWhole = let m = rhs parseState 1 match getSetRangeOpt with | None -> unionRanges m ty.Range | Some m2 -> unionRanges m m2 |> unionRangeWithXmlDoc doc - if Option.isSome $2 then errorR(Error(FSComp.SR.parsAccessibilityModsIllegalForAbstract(), wholeRange)) - let valSpfn = SynValSig($1, id, explicitValTyparDecls, ty, arity, isInline, false, doc, None, None, wholeRange, { ValKeyword = None; WithKeyword = mWith; EqualsRange = None }) - [ SynMemberDefn.AbstractSlot(valSpfn, AbstractMemberFlags $3 (getSetAdjuster arity), wholeRange) ] } + if Option.isSome $2 then errorR(Error(FSComp.SR.parsAccessibilityModsIllegalForAbstract(), mWhole)) + let valSpfn = SynValSig($1, id, explicitValTyparDecls, ty, arity, isInline, false, doc, None, None, mWhole, { ValKeyword = None; WithKeyword = mWith; EqualsRange = None }) + [ SynMemberDefn.AbstractSlot(valSpfn, AbstractMemberFlags $3 (getSetAdjuster arity), mWhole) ] } | opt_attributes opt_declVisibility inheritsDefn { if not (isNil $1) then errorR(Error(FSComp.SR.parsAttributesIllegalOnInherit(), rhs parseState 1)) @@ -1998,13 +2002,13 @@ atomicPatternLongIdent: raiseParseErrorAt (rhs parseState 2) (FSComp.SR.parsUnexpectedSymbolDot()) let underscore = ident("_", rhs parseState 1) - let dotm = rhs parseState 2 - None, prependIdentInLongIdentWithTrivia (SynIdent(underscore, None)) dotm $3 } + let mDot = rhs parseState 2 + None, prependIdentInLongIdentWithTrivia (SynIdent(underscore, None)) mDot $3 } | GLOBAL DOT pathOp { let globalIdent = ident(MangledGlobalName, rhs parseState 1) - let dotm = rhs parseState 2 - None, prependIdentInLongIdentWithTrivia (SynIdent(globalIdent, None)) dotm $3 } + let mDot = rhs parseState 2 + None, prependIdentInLongIdentWithTrivia (SynIdent(globalIdent, None)) mDot $3 } | pathOp { (None, $1) } @@ -2014,8 +2018,8 @@ atomicPatternLongIdent: raiseParseErrorAt (rhs parseState 3) (FSComp.SR.parsUnexpectedSymbolDot()) let underscore = ident("_", rhs parseState 2) - let dotm = rhs parseState 3 - Some($1), prependIdentInLongIdentWithTrivia (SynIdent(underscore, None)) dotm $4 } + let mDot = rhs parseState 3 + Some($1), prependIdentInLongIdentWithTrivia (SynIdent(underscore, None)) mDot $4 } | access pathOp { (Some($1), $2) } @@ -2184,7 +2188,7 @@ tyconDefnOrSpfnSimpleRepr: /* A union type definition */ | opt_attributes opt_declVisibility unionTypeRepr { if not (isNil $1) then errorR(Error(FSComp.SR.parsAttributesIllegalHere(), rhs parseState 1)) - let rangesOf3 = $3 |> List.map (function |Choice1Of2(ec)->ec.Range | Choice2Of2(uc)->uc.Range) + let rangesOf3 = $3 |> List.map (function Choice1Of2 ec -> ec.Range | Choice2Of2 uc -> uc.Range) let mWhole = (rhs2 parseState 1 2, rangesOf3) ||> List.fold unionRanges if $3 |> List.exists (function Choice1Of2 _ -> true | _ -> false) then ( if Option.isSome $2 then errorR(Error(FSComp.SR.parsEnumTypesCannotHaveVisibilityDeclarations(), rhs parseState 2)); @@ -2207,12 +2211,12 @@ tyconDefnOrSpfnSimpleRepr: /* An inline-assembly type definition, for FSharp.Core library only */ | opt_attributes opt_declVisibility LPAREN HASH string HASH rparen { if not (isNil $1) then errorR(Error(FSComp.SR.parsAttributesIllegalHere(), rhs parseState 1)) - let lhsm = lhs parseState - if parseState.LexBuffer.ReportLibraryOnlyFeatures then libraryOnlyError lhsm + let mLhs = lhs parseState + if parseState.LexBuffer.ReportLibraryOnlyFeatures then libraryOnlyError mLhs if Option.isSome $2 then errorR(Error(FSComp.SR.parsInlineAssemblyCannotHaveVisibilityDeclarations(), rhs parseState 2)) let s, _ = $5 let ilType = ParseAssemblyCodeType s parseState.LexBuffer.ReportLibraryOnlyFeatures parseState.LexBuffer.LanguageVersion (rhs parseState 5) - SynTypeDefnSimpleRepr.LibraryOnlyILAssembly (box ilType, lhsm) } + SynTypeDefnSimpleRepr.LibraryOnlyILAssembly (box ilType, mLhs) } /* The core of a record type definition */ @@ -2513,8 +2517,8 @@ unionCaseReprElements: unionCaseReprElement: | ident COLON appType { let xmlDoc = grabXmlDoc(parseState, [], 1) - let wholeRange = rhs2 parseState 1 3 |> unionRangeWithXmlDoc xmlDoc - mkSynNamedField ($1, $3, xmlDoc, wholeRange) } + let mWhole = rhs2 parseState 1 3 |> unionRangeWithXmlDoc xmlDoc + mkSynNamedField ($1, $3, xmlDoc, mWhole) } | appType { let xmlDoc = grabXmlDoc(parseState, [], 1) @@ -2539,19 +2543,19 @@ recdFieldDeclList: /* A field declaration in a record type */ recdFieldDecl: | opt_attributes fieldDecl - { let wholeRange = rhs2 parseState 1 2 - let fld = $2 $1 false wholeRange - let (SynField (a, b, c, d, e, xmlDoc, vis, wholeRange)) = fld + { let mWhole = rhs2 parseState 1 2 + let fld = $2 $1 false mWhole + let (SynField (a, b, c, d, e, xmlDoc, vis, mWhole)) = fld if Option.isSome vis then errorR (Error (FSComp.SR.parsRecordFieldsCannotHaveVisibilityDeclarations (), rhs parseState 2)) - let wholeRange = unionRangeWithXmlDoc xmlDoc wholeRange - SynField (a, b, c, d, e, xmlDoc, None, wholeRange) } + let mWhole = unionRangeWithXmlDoc xmlDoc mWhole + SynField (a, b, c, d, e, xmlDoc, None, mWhole) } /* Part of a field or val declaration in a record type or object type */ fieldDecl: | opt_mutable opt_access ident COLON typ - { fun attrs stat wholeRange -> - let xmlDoc = grabXmlDocAtRangeStart(parseState, attrs, wholeRange) - SynField(attrs, stat, Some $3, $5, $1, xmlDoc, $2, wholeRange) } + { fun attrs stat mWhole -> + let xmlDoc = grabXmlDocAtRangeStart(parseState, attrs, mWhole) + SynField(attrs, stat, Some $3, $5, $1, xmlDoc, $2, mWhole) } /* An exception definition */ exconDefn: @@ -3322,12 +3326,12 @@ parenPattern: { SynPat.Ands(List.rev $1, rhs2 parseState 1 3) } | parenPattern COLON typeWithTypeConstraints %prec paren_pat_colon - { let lhsm = lhs parseState - SynPat.Typed($1, $3, lhsm) } + { let mLhs = lhs parseState + SynPat.Typed($1, $3, mLhs) } | attributes parenPattern %prec paren_pat_attribs - { let lhsm = lhs parseState - SynPat.Attrib($2, $1, lhsm) } + { let mLhs = lhs parseState + SynPat.Attrib($2, $1, mLhs) } | parenPattern COLON_COLON parenPattern { SynPat.LongIdent (SynLongIdent(mkSynCaseName (rhs parseState 2) opNameCons, [], [ Some (IdentTrivia.OriginalNotation "::") ]), None, None, SynArgPats.Pats [ SynPat.Tuple (false, [$1;$3], rhs2 parseState 1 3) ], None, lhs parseState) } @@ -3990,18 +3994,18 @@ declExpr: | declExpr DOT_DOT declExpr { let wholem = rhs2 parseState 1 3 - let opm = rhs parseState 2 - SynExpr.IndexRange(Some $1, opm, Some $3, rhs parseState 1, rhs parseState 3, wholem) } + let mOperator = rhs parseState 2 + SynExpr.IndexRange(Some $1, mOperator, Some $3, rhs parseState 1, rhs parseState 3, wholem) } | declExpr DOT_DOT %prec open_range_expr { let wholem = rhs2 parseState 1 2 - let opm = rhs parseState 2 - SynExpr.IndexRange(Some $1, opm, None, rhs parseState 1, opm, wholem) } + let mOperator = rhs parseState 2 + SynExpr.IndexRange(Some $1, mOperator, None, rhs parseState 1, mOperator, wholem) } | DOT_DOT declExpr %prec open_range_expr { let wholem = rhs2 parseState 1 2 - let opm = rhs parseState 1 - SynExpr.IndexRange(None, opm, Some $2, opm, rhs parseState 2, wholem) } + let mOperator = rhs parseState 1 + SynExpr.IndexRange(None, mOperator, Some $2, mOperator, rhs parseState 2, wholem) } | STAR { let m = rhs parseState 1 @@ -4351,61 +4355,61 @@ atomicExpr: atomicExprQualification: | identOrOp { let idm = rhs parseState 1 - (fun e lhsm dotm -> mkSynDot dotm lhsm e $1) } + (fun e mLhs mDot -> mkSynDot mDot mLhs e $1) } | GLOBAL - { (fun e lhsm dotm -> + { (fun e mLhs mDot -> reportParseErrorAt (rhs parseState 3) (FSComp.SR.nrGlobalUsedOnlyAsFirstName()) - let fixedLhsm = mkRange lhsm.FileName lhsm.Start dotm.End // previous lhsm is wrong after 'recover' - mkSynDotMissing dotm fixedLhsm e) } + let fixedLhsm = mkRange mLhs.FileName mLhs.Start mDot.End // previous mLhs is wrong after 'recover' + mkSynDotMissing mDot fixedLhsm e) } | /* empty */ - { (fun e lhsm dotm -> - reportParseErrorAt dotm (FSComp.SR.parsMissingQualificationAfterDot()) - let fixedLhsm = mkRange lhsm.FileName lhsm.Start dotm.End // previous lhsm is wrong after 'recover' - mkSynDotMissing dotm fixedLhsm e) } + { (fun e mLhs mDot -> + reportParseErrorAt mDot (FSComp.SR.parsMissingQualificationAfterDot()) + let fixedLhsm = mkRange mLhs.FileName mLhs.Start mDot.End // previous mLhs is wrong after 'recover' + mkSynDotMissing mDot fixedLhsm e) } | recover - { (fun e lhsm dotm -> - reportParseErrorAt dotm (FSComp.SR.parsMissingQualificationAfterDot()) - let fixedLhsm = mkRange lhsm.FileName lhsm.Start dotm.End // previous lhsm is wrong after 'recover' + { (fun e mLhs mDot -> + reportParseErrorAt mDot (FSComp.SR.parsMissingQualificationAfterDot()) + let fixedLhsm = mkRange mLhs.FileName mLhs.Start mDot.End // previous mLhs is wrong after 'recover' // Include 'e' in the returned expression but throw it away SynExpr.DiscardAfterMissingQualificationAfterDot (e, fixedLhsm)) } | LPAREN COLON_COLON rparen DOT INT32 - { (fun e lhsm dotm -> + { (fun e mLhs mDot -> if parseState.LexBuffer.ReportLibraryOnlyFeatures then libraryOnlyError(lhs parseState) - SynExpr.LibraryOnlyUnionCaseFieldGet (e, mkSynCaseName lhsm opNameCons, (fst $5), lhsm)) } + SynExpr.LibraryOnlyUnionCaseFieldGet (e, mkSynCaseName mLhs opNameCons, (fst $5), mLhs)) } | LPAREN typedSequentialExpr rparen { let lpr = rhs parseState 1 let rpr = rhs parseState 3 - (fun e lhsm dotm -> + (fun e mLhs mDot -> // Check for expr.( * ) // Note that "*" is parsed as an expression (it is allowed in "foo.[3,*]") match $2 with - | SynExpr.IndexRange (None, opm, None, _m1, _m2, _) -> - mkSynDot dotm lhsm e (SynIdent(ident(CompileOpName "*", opm), Some(IdentTrivia.OriginalNotationWithParen(lpr, "*", rpr)))) + | SynExpr.IndexRange (None, mOperator, None, _m1, _m2, _) -> + mkSynDot mDot mLhs e (SynIdent(ident(CompileOpName "*", mOperator), Some(IdentTrivia.OriginalNotationWithParen(lpr, "*", rpr)))) | _ -> if parseState.LexBuffer.SupportsFeature LanguageFeature.MLCompatRevisions then mlCompatError (FSComp.SR.mlCompatMultiPrefixTyparsNoLongerSupported()) (lhs parseState) else mlCompatWarning (FSComp.SR.parsParenFormIsForML()) (lhs parseState) - mkSynDotParenGet lhsm dotm e $2) } + mkSynDotParenGet mLhs mDot e $2) } | LBRACK typedSequentialExpr RBRACK - { (fun e lhsm dotm -> mkSynDotBrackGet lhsm dotm e $2) } + { (fun e mLhs mDot -> mkSynDotBrackGet mLhs mDot e $2) } | LBRACK typedSequentialExpr recover { reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsUnmatchedBracket()) - (fun e lhsm dotm -> exprFromParseError (mkSynDotBrackGet lhsm dotm e $2)) } + (fun e mLhs mDot -> exprFromParseError (mkSynDotBrackGet mLhs mDot e $2)) } | LBRACK error RBRACK { let mArg = rhs2 parseState 1 3 - (fun e lhsm dotm -> mkSynDotBrackGet lhsm dotm e (arbExpr("indexerExpr1", mArg))) } + (fun e mLhs mDot -> mkSynDotBrackGet mLhs mDot e (arbExpr("indexerExpr1", mArg))) } | LBRACK recover { reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsUnmatchedBracket()) let mArg = (rhs parseState 1).EndRange - (fun e lhsm dotm -> exprFromParseError (mkSynDotBrackGet lhsm dotm e (arbExpr("indexerExpr2", mArg)))) } + (fun e mLhs mDot -> exprFromParseError (mkSynDotBrackGet mLhs mDot e (arbExpr("indexerExpr2", mArg)))) } /* the start of atomicExprAfterType must not overlap with the valid postfix tokens of the type syntax, e.g. new List(...) */ atomicExprAfterType: @@ -4499,8 +4503,8 @@ parenExpr: | LPAREN parenExprBody ends_other_than_rparen_coming_soon_or_recover { if not $3 then reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsUnmatchedParen()) - let lhsm = unionRangeWithPos (rhs parseState 1) (rhs parseState 2).End - SynExpr.Paren (exprFromParseError ($2 lhsm), rhs parseState 1, None, lhsm) } + let mLhs = unionRangeWithPos (rhs parseState 1) (rhs parseState 2).End + SynExpr.Paren (exprFromParseError ($2 mLhs), rhs parseState 1, None, mLhs) } | LPAREN error rparen { // silent recovery @@ -4508,18 +4512,18 @@ parenExpr: | LPAREN TYPE_COMING_SOON { reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsUnmatchedParen()) - let lhsm = unionRangeWithPos (rhs parseState 1) (rhs parseState 2).Start - arbExpr("parenExpr2tcs", lhsm) } + let mLhs = unionRangeWithPos (rhs parseState 1) (rhs parseState 2).Start + arbExpr("parenExpr2tcs", mLhs) } | LPAREN MODULE_COMING_SOON { reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsUnmatchedParen()) - let lhsm = unionRangeWithPos (rhs parseState 1) (rhs parseState 2).Start - arbExpr("parenExpr2mcs", lhsm) } + let mLhs = unionRangeWithPos (rhs parseState 1) (rhs parseState 2).Start + arbExpr("parenExpr2mcs", mLhs) } | LPAREN RBRACE_COMING_SOON { reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsUnmatchedParen()) - let lhsm = unionRangeWithPos (rhs parseState 1) (rhs parseState 2).Start - arbExpr("parenExpr2rbcs", lhsm) } + let mLhs = unionRangeWithPos (rhs parseState 1) (rhs parseState 2).Start + arbExpr("parenExpr2rbcs", mLhs) } | LPAREN OBLOCKEND_COMING_SOON { let lparenRange = (rhs parseState 1) @@ -4534,8 +4538,8 @@ parenExpr: // to extend all the way over the "recover", to the end of the file if necessary // // let mLeftParen = rhs parseState 1 - //let lhsm = if $2 then unionRangeWithPos mLeftParen (rhs parseState 2).Start else mLeftParen - //arbExpr("parenExpr2", lhsm) } + //let mLhs = if $2 then unionRangeWithPos mLeftParen (rhs parseState 2).Start else mLeftParen + //arbExpr("parenExpr2", mLhs) } parenExprBody: | staticallyKnownHeadTypars COLON LPAREN classMemberSpfn rparen typedSequentialExpr @@ -4596,21 +4600,21 @@ braceExprBody: listExprElements: | sequentialExpr - { (fun lhsm -> SynExpr.ArrayOrListComputed (false, $1, lhsm)) } + { (fun mLhs -> SynExpr.ArrayOrListComputed (false, $1, mLhs)) } | - { (fun lhsm -> SynExpr.ArrayOrList (false, [ ], lhsm)) } + { (fun mLhs -> SynExpr.ArrayOrList (false, [ ], mLhs)) } arrayExprElements: | sequentialExpr - { (fun lhsm -> SynExpr.ArrayOrListComputed (true, $1, lhsm)) } + { (fun mLhs -> SynExpr.ArrayOrListComputed (true, $1, mLhs)) } | - { (fun lhsm -> SynExpr.ArrayOrList (true, [ ], lhsm)) } + { (fun mLhs -> SynExpr.ArrayOrList (true, [ ], mLhs)) } computationExpr: | sequentialExpr - { $1.Range, (fun lhsm -> SynExpr.ComputationExpr (false, $1, lhsm)) } + { $1.Range, (fun mLhs -> SynExpr.ComputationExpr (false, $1, mLhs)) } arrowThenExprR: | RARROW typedSequentialExprBlockR diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index a35ece58510..fda69bff63f 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -192,6 +192,11 @@ rozhraní s vícenásobným obecným vytvářením instancí + + Allow lowercase DU when RequireQualifiedAccess attribute + Allow lowercase DU when RequireQualifiedAccess attribute + + ML compatibility revisions Revize kompatibility ML diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index 82283fe4ef5..394943a57e3 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -192,6 +192,11 @@ Schnittstellen mit mehrfacher generischer Instanziierung + + Allow lowercase DU when RequireQualifiedAccess attribute + Allow lowercase DU when RequireQualifiedAccess attribute + + ML compatibility revisions ML-Kompatibilitätsrevisionen diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index e886d028615..133b11d834f 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -192,6 +192,11 @@ interfaces con creación de instancias genéricas múltiples + + Allow lowercase DU when RequireQualifiedAccess attribute + Allow lowercase DU when RequireQualifiedAccess attribute + + ML compatibility revisions Revisiones de compatibilidad de ML diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index 4990250d81c..050de24fcae 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -192,6 +192,11 @@ interfaces avec plusieurs instanciations génériques + + Allow lowercase DU when RequireQualifiedAccess attribute + Allow lowercase DU when RequireQualifiedAccess attribute + + ML compatibility revisions Réviseurs de compatibilité ML diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index f32f9891d15..18dfa3def7e 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -192,6 +192,11 @@ interfacce con più creazioni di istanze generiche + + Allow lowercase DU when RequireQualifiedAccess attribute + Allow lowercase DU when RequireQualifiedAccess attribute + + ML compatibility revisions Revisioni della compatibilità di Ml diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index 082c4e84a92..ae2b9e658ae 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -192,6 +192,11 @@ 複数のジェネリックのインスタンス化を含むインターフェイス + + Allow lowercase DU when RequireQualifiedAccess attribute + Allow lowercase DU when RequireQualifiedAccess attribute + + ML compatibility revisions ML 互換性のリビジョン diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 06669718825..c8c5e20174b 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -192,6 +192,11 @@ 여러 제네릭 인스턴스화가 포함된 인터페이스 + + Allow lowercase DU when RequireQualifiedAccess attribute + Allow lowercase DU when RequireQualifiedAccess attribute + + ML compatibility revisions ML 호환성 개정 diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index 911efdac74d..2e5eed91359 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -192,6 +192,11 @@ interfejsy z wieloma ogólnymi wystąpieniami + + Allow lowercase DU when RequireQualifiedAccess attribute + Allow lowercase DU when RequireQualifiedAccess attribute + + ML compatibility revisions Poprawki dotyczące zgodności Machine Learning diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 22bb59aa8bd..5ba3615dd11 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -192,6 +192,11 @@ interfaces com várias instanciações genéricas + + Allow lowercase DU when RequireQualifiedAccess attribute + Allow lowercase DU when RequireQualifiedAccess attribute + + ML compatibility revisions Revisões de compatibilidade de ML diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index 30563882224..f25c3cb7d8d 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -192,6 +192,11 @@ интерфейсы с множественным универсальным созданием экземпляра + + Allow lowercase DU when RequireQualifiedAccess attribute + Allow lowercase DU when RequireQualifiedAccess attribute + + ML compatibility revisions Редакции совместимости ML diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index 94f5f37e105..28a47a02d20 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -192,6 +192,11 @@ birden çok genel örnek oluşturma içeren arabirimler + + Allow lowercase DU when RequireQualifiedAccess attribute + Allow lowercase DU when RequireQualifiedAccess attribute + + ML compatibility revisions ML uyumluluk düzeltmeleri diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index 71f44423b0c..5f88ef95941 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -192,6 +192,11 @@ 具有多个泛型实例化的接口 + + Allow lowercase DU when RequireQualifiedAccess attribute + Allow lowercase DU when RequireQualifiedAccess attribute + + ML compatibility revisions ML 兼容性修订 diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index 8788739eb7c..3cdd6b3070f 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -192,6 +192,11 @@ 具有多個泛型具現化的介面 + + Allow lowercase DU when RequireQualifiedAccess attribute + Allow lowercase DU when RequireQualifiedAccess attribute + + ML compatibility revisions ML 相容性修訂 diff --git a/src/Compiler/xlf/FSStrings.cs.xlf b/src/Compiler/xlf/FSStrings.cs.xlf index bbe35b11bcc..f80da09f758 100644 --- a/src/Compiler/xlf/FSStrings.cs.xlf +++ b/src/Compiler/xlf/FSStrings.cs.xlf @@ -7,6 +7,11 @@ Nejméně jedna informační zpráva v načteném souboru\n + + Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + + symbol '..^' symbol ..^ diff --git a/src/Compiler/xlf/FSStrings.de.xlf b/src/Compiler/xlf/FSStrings.de.xlf index 057e3f528b2..8978b176751 100644 --- a/src/Compiler/xlf/FSStrings.de.xlf +++ b/src/Compiler/xlf/FSStrings.de.xlf @@ -7,6 +7,11 @@ Mindestens eine Informationsmeldung in der geladenen Datei.\n + + Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + + symbol '..^' Symbol "..^" diff --git a/src/Compiler/xlf/FSStrings.es.xlf b/src/Compiler/xlf/FSStrings.es.xlf index 28cf2d839d7..bc0ce4ad5a8 100644 --- a/src/Compiler/xlf/FSStrings.es.xlf +++ b/src/Compiler/xlf/FSStrings.es.xlf @@ -7,6 +7,11 @@ Uno o más mensajes informativos en el archivo cargado.\n + + Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + + symbol '..^' símbolo "..^" diff --git a/src/Compiler/xlf/FSStrings.fr.xlf b/src/Compiler/xlf/FSStrings.fr.xlf index 53e4eb6cff4..f88d8e7182b 100644 --- a/src/Compiler/xlf/FSStrings.fr.xlf +++ b/src/Compiler/xlf/FSStrings.fr.xlf @@ -7,6 +7,11 @@ Un ou plusieurs messages d’information dans le fichier chargé.\n + + Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + + symbol '..^' symbole '..^' diff --git a/src/Compiler/xlf/FSStrings.it.xlf b/src/Compiler/xlf/FSStrings.it.xlf index 7f475a4ff7b..90d7b1611ff 100644 --- a/src/Compiler/xlf/FSStrings.it.xlf +++ b/src/Compiler/xlf/FSStrings.it.xlf @@ -7,6 +7,11 @@ Uno o più messaggi informativi nel file caricato.\n + + Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + + symbol '..^' simbolo '..^' diff --git a/src/Compiler/xlf/FSStrings.ja.xlf b/src/Compiler/xlf/FSStrings.ja.xlf index ad32096733b..b0a149427b1 100644 --- a/src/Compiler/xlf/FSStrings.ja.xlf +++ b/src/Compiler/xlf/FSStrings.ja.xlf @@ -7,6 +7,11 @@ 読み込まれたファイル内の 1 つ以上の情報メッセージ。\n + + Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + + symbol '..^' シンボル '..^' diff --git a/src/Compiler/xlf/FSStrings.ko.xlf b/src/Compiler/xlf/FSStrings.ko.xlf index a3fb6693290..95015040f09 100644 --- a/src/Compiler/xlf/FSStrings.ko.xlf +++ b/src/Compiler/xlf/FSStrings.ko.xlf @@ -7,6 +7,11 @@ 로드된 파일에 하나 이상의 정보 메시지가 있습니다.\n + + Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + + symbol '..^' 기호 '..^' diff --git a/src/Compiler/xlf/FSStrings.pl.xlf b/src/Compiler/xlf/FSStrings.pl.xlf index d891fb04f44..48a2f8adedc 100644 --- a/src/Compiler/xlf/FSStrings.pl.xlf +++ b/src/Compiler/xlf/FSStrings.pl.xlf @@ -7,6 +7,11 @@ Jeden lub więcej komunikatów informacyjnych w załadowanym pliku.\n + + Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + + symbol '..^' symbol „..^” diff --git a/src/Compiler/xlf/FSStrings.pt-BR.xlf b/src/Compiler/xlf/FSStrings.pt-BR.xlf index 242d057f55c..1929c486cda 100644 --- a/src/Compiler/xlf/FSStrings.pt-BR.xlf +++ b/src/Compiler/xlf/FSStrings.pt-BR.xlf @@ -7,6 +7,11 @@ Uma ou mais mensagens informativas no arquivo carregado.\n + + Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + + symbol '..^' símbolo '..^' diff --git a/src/Compiler/xlf/FSStrings.ru.xlf b/src/Compiler/xlf/FSStrings.ru.xlf index 6ae359a1229..1e91c13cd4c 100644 --- a/src/Compiler/xlf/FSStrings.ru.xlf +++ b/src/Compiler/xlf/FSStrings.ru.xlf @@ -7,6 +7,11 @@ Одно или несколько информационных сообщений в загруженном файле.\n + + Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + + symbol '..^' символ "..^" diff --git a/src/Compiler/xlf/FSStrings.tr.xlf b/src/Compiler/xlf/FSStrings.tr.xlf index 893935e94c3..31b4cad81af 100644 --- a/src/Compiler/xlf/FSStrings.tr.xlf +++ b/src/Compiler/xlf/FSStrings.tr.xlf @@ -7,6 +7,11 @@ Yüklenen dosyada bir veya daha fazla bilgi mesajı.\n + + Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + + symbol '..^' '..^' sembolü diff --git a/src/Compiler/xlf/FSStrings.zh-Hans.xlf b/src/Compiler/xlf/FSStrings.zh-Hans.xlf index 95130a6391f..be3604df4bf 100644 --- a/src/Compiler/xlf/FSStrings.zh-Hans.xlf +++ b/src/Compiler/xlf/FSStrings.zh-Hans.xlf @@ -7,6 +7,11 @@ 加载文件 .\n 中有一条或多条信息性消息 + + Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + + symbol '..^' 符号 "..^" diff --git a/src/Compiler/xlf/FSStrings.zh-Hant.xlf b/src/Compiler/xlf/FSStrings.zh-Hant.xlf index 5ff1442b5c3..67e6c25370e 100644 --- a/src/Compiler/xlf/FSStrings.zh-Hant.xlf +++ b/src/Compiler/xlf/FSStrings.zh-Hant.xlf @@ -7,6 +7,11 @@ 已載入檔案中的一或多個資訊訊息。\n + + Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + + symbol '..^' 符號 '..^' diff --git a/src/FSharp.Core/Linq.fs b/src/FSharp.Core/Linq.fs index 5b383f2c3d2..33a1dd18265 100644 --- a/src/FSharp.Core/Linq.fs +++ b/src/FSharp.Core/Linq.fs @@ -75,7 +75,170 @@ module LeafExpressionConverter = let NullableConstructor = typedefof>.GetConstructors().[0] - + + let getNonNullableType typ = match Nullable.GetUnderlyingType typ with null -> typ | t -> t + + // https://github.com/dotnet/runtime/blob/fa779e8cb2b5868a0ac2fd4215f39ffb91f0dab0/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/TypeUtils.cs#L72 + /// Can LINQ Expressions' BinaryExpression's (Left/Right)Shift construct a SimpleBinaryExpression from the type in question? Otherwise, use the F# operator as the user-defined method. + let isLinqExpressionsInteger typ = + let typ = getNonNullableType typ + not typ.IsEnum && + match Type.GetTypeCode typ with + | TypeCode.Byte + | TypeCode.SByte + | TypeCode.Int16 + | TypeCode.Int32 + | TypeCode.Int64 + | TypeCode.UInt16 + | TypeCode.UInt32 + | TypeCode.UInt64 -> true + | _ -> false + + // https://github.com/dotnet/runtime/blob/fa779e8cb2b5868a0ac2fd4215f39ffb91f0dab0/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/BinaryExpression.cs#L2226 + /// Can LINQ Expressions' BinaryExpression's (Left/Right)Shift construct a SimpleBinaryExpression from the type in question? Otherwise, use the F# operator as the user-defined method. + let isLinqExpressionsSimpleShift left right = + isLinqExpressionsInteger left && getNonNullableType right = typeof + + // https://github.com/dotnet/runtime/blob/cf7e7a46f8a4a6225a8f1e059a846ccdebf0454c/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/TypeUtils.cs#L110 + /// Can LINQ Expressions' (UnaryExpression/BinaryExpression)'s arithmetic operations construct a (SimpleBinaryExpression/UnaryExpression) from the type in question? Otherwise, use the F# operator as the user-defined method. + let isLinqExpressionsArithmeticType typ = + let typ = getNonNullableType typ + not typ.IsEnum && + match Type.GetTypeCode typ with + | TypeCode.Int16 + | TypeCode.Int32 + | TypeCode.Int64 + | TypeCode.Double + | TypeCode.Single + | TypeCode.UInt16 + | TypeCode.UInt32 + | TypeCode.UInt64 -> true + | _ -> false + + // https://github.com/dotnet/runtime/blob/7bd472498e690e9421df86d5a9d728faa939742c/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/TypeUtils.cs#L132 + /// Can LINQ Expressions' UnaryExpression.(Checked)Negate construct a UnaryExpression from the type in question? Otherwise, use the F# operator as the user-defined method. + let isLinqExpressionsArithmeticTypeButNotUnsignedInt typ = + isLinqExpressionsArithmeticType typ && + let typ = getNonNullableType typ + not typ.IsEnum && + match Type.GetTypeCode typ with + | TypeCode.UInt16 + | TypeCode.UInt32 + | TypeCode.UInt64 -> false + | _ -> true + + // https://github.com/dotnet/runtime/blob/7bd472498e690e9421df86d5a9d728faa939742c/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/TypeUtils.cs#L149 + /// Can LINQ Expressions' (UnaryExpression.Not/BinaryExpression.Binary(And/Or/ExclusiveOr)) construct a (UnaryExpression/SimpleBinaryExpression) from the type in question? Otherwise, use the F# operator as the user-defined method. + let isLinqExpressionsIntegerOrBool typ = + let typ = getNonNullableType typ + not typ.IsEnum && + match Type.GetTypeCode typ with + | TypeCode.Int64 + | TypeCode.Int32 + | TypeCode.Int16 + | TypeCode.UInt64 + | TypeCode.UInt32 + | TypeCode.UInt16 + | TypeCode.Boolean + | TypeCode.SByte + | TypeCode.Byte -> true + | _ -> false + + // https://github.com/dotnet/runtime/blob/7bd472498e690e9421df86d5a9d728faa939742c/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/TypeUtils.cs#L47 + /// Can LINQ Expressions' BinaryExpression's comparison operations construct a (SimpleBinaryExpression/LogicalBinaryExpression) from the type in question? Otherwise, use the F# operator as the user-defined method. + let isLinqExpressionsNumeric typ = + let typ = getNonNullableType typ + not typ.IsEnum && + match Type.GetTypeCode typ with + | TypeCode.Char + | TypeCode.SByte + | TypeCode.Byte + | TypeCode.Int16 + | TypeCode.Int32 + | TypeCode.Int64 + | TypeCode.Double + | TypeCode.Single + | TypeCode.UInt16 + | TypeCode.UInt32 + | TypeCode.UInt64 -> true + | _ -> false + + // https://github.com/dotnet/runtime/blob/afaf666eff08435123eb649ac138419f4c9b9344/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/BinaryExpression.cs#L1047 + /// Can LINQ Expressions' BinaryExpression's equality operations provide built-in structural equality from the type in question? Otherwise, use the F# operator as the user-defined method. + let isLinqExpressionsStructurallyEquatable typ = + isLinqExpressionsNumeric typ || typ = typeof || getNonNullableType(typ).IsEnum + + // https://github.com/dotnet/runtime/blob/4c92aef2b08f9c4374c520e7e664a44f1ad8ce56/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/BinaryExpression.cs#L1221 + /// Can LINQ Expressions' BinaryExpression's comparison operations provide built-in comparison from the type in question? Otherwise, use the F# operator as the user-defined method. + let isLinqExpressionsComparable = isLinqExpressionsNumeric + + /// Can LINQ Expressions' BinaryExpression's equality operations provide built-in equality from the type in question? Otherwise, use the F# operator as the user-defined method. + let isLinqExpressionsEquatable typ = + isLinqExpressionsStructurallyEquatable typ || typ = typeof + + /// Can LINQ Expressions' BinaryExpression's conversion operations provide built-in conversion from source to dest? Otherwise, use the F# operator as the user-defined method. + let isLinqExpressionsConvertible source dest = + // https://github.com/dotnet/runtime/blob/4c92aef2b08f9c4374c520e7e664a44f1ad8ce56/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/UnaryExpression.cs#L757 + // expression.Type.HasIdentityPrimitiveOrNullableConversionTo(type) || expression.Type.HasReferenceConversionTo(type)) + // In other words, source.HasIdentityPrimitiveOrNullableConversionTo dest || source.HasReferenceConversionTo dest + + // https://github.com/dotnet/runtime/blob/4c92aef2b08f9c4374c520e7e664a44f1ad8ce56/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/TypeUtils.cs#L532 + let isConvertible typ = + let typ = getNonNullableType typ + typ.IsEnum || + match Type.GetTypeCode typ with + | TypeCode.Boolean + | TypeCode.Byte + | TypeCode.SByte + | TypeCode.Int16 + | TypeCode.Int32 + | TypeCode.Int64 + | TypeCode.UInt16 + | TypeCode.UInt32 + | TypeCode.UInt64 + | TypeCode.Single + | TypeCode.Double + | TypeCode.Char -> true + | _ -> false + // https://github.com/dotnet/runtime/blob/4c92aef2b08f9c4374c520e7e664a44f1ad8ce56/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/TypeUtils.cs#L229 + // HasIdentityPrimitiveOrNullableConversionTo + getNonNullableType(source).IsEquivalentTo dest + || dest.IsEquivalentTo(getNonNullableType source) + || isConvertible source && isConvertible dest + && (getNonNullableType dest <> typeof || source.IsEnum && source.GetEnumUnderlyingType() = typeof) + + || + // https://github.com/dotnet/runtime/blob/4c92aef2b08f9c4374c520e7e664a44f1ad8ce56/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/TypeUtils.cs#L458 + // IsLegalExplicitVariantDelegateConversion + // https://github.com/dotnet/runtime/blob/4c92aef2b08f9c4374c520e7e664a44f1ad8ce56/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/TypeUtils.cs#L260 + // HasReferenceConversionTo + let rec hasReferenceConversionTo source dest = + + // { if (source == typeof(void) || dest == typeof(void)) return false; } invalidates an identity conversion. This is handled by the IsEquivalentTo check above. + let nnSourceType, nnDestType = getNonNullableType source, getNonNullableType dest + + // Down conversion + nnSourceType.IsAssignableFrom nnDestType + // Up conversion + || nnDestType.IsAssignableFrom nnSourceType + + // Interface conversion + || source.IsInterface || dest.IsInterface + + // The following part shouldn't be needed for our usage of isLinqExpressionsConvertible here because we only use this for potentially nullable built-in numeric types +(* + // Variant delegate conversion + if (IsLegalExplicitVariantDelegateConversion(source, dest)) + { + return true; + } + + // Object conversion handled by assignable above. + Debug.Assert(source != typeof(object) && dest != typeof(object)); + + return (source.IsArray || dest.IsArray) && StrictHasReferenceConversionTo(source, dest, true); +*) + hasReferenceConversionTo source dest let SpecificCallToMethodInfo (minfo: System.Reflection.MethodInfo) = let isg1 = minfo.IsGenericMethod let gmd = if isg1 then minfo.GetGenericMethodDefinition() else null @@ -87,19 +250,20 @@ module LeafExpressionConverter = if isg1 then minfo2.IsGenericMethod && gmd = minfo2.GetGenericMethodDefinition() else minfo = minfo2 ) -> - Some (obj, (minfo2.GetGenericArguments() |> Array.toList), args) + Some (obj, minfo2, args) | _ -> None) - - let (|SpecificCallToMethod|_|) (mhandle: System.RuntimeMethodHandle) = + let (|SpecificCallToMethod|_|) (mhandle: RuntimeMethodHandle) = let minfo = (System.Reflection.MethodInfo.GetMethodFromHandle mhandle) :?> MethodInfo SpecificCallToMethodInfo minfo + let (|GenericArgs|) (minfo: MethodInfo) = minfo.GetGenericArguments() + let (|PhysicalEqualityQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun (x, y) -> LanguagePrimitives.PhysicalEquality x y)) let (|GenericEqualityQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun (x, y) -> LanguagePrimitives.GenericEquality x y)) let (|EqualsQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun (x, y) -> x = y)) let (|GreaterQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun (x, y) -> x > y)) let (|GreaterEqQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun (x, y) -> x >= y)) - let (|LessQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun (x, y) -> x < y)) + let (|LessQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun (x, y) -> x < y)) let (|LessEqQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun (x, y) -> x <= y)) let (|NotEqQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun (x, y) -> x <> y)) @@ -185,6 +349,8 @@ module LeafExpressionConverter = let (|ConvUInt16Q|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Operators.uint16 x)) let (|ConvUInt32Q|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Operators.uint32 x)) let (|ConvUInt64Q|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Operators.uint64 x)) + let (|ConvIntPtrQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Operators.nativeint x)) + let (|ConvUIntPtrQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Operators.unativeint x)) let (|ConvInt8Q|_|) = SpecificCallToMethodInfo (typeof.Assembly.GetType("Microsoft.FSharp.Core.ExtraTopLevelOperators").GetMethod("ToSByte")) let (|ConvUInt8Q|_|) = SpecificCallToMethodInfo (typeof.Assembly.GetType("Microsoft.FSharp.Core.ExtraTopLevelOperators").GetMethod("ToByte")) @@ -208,10 +374,8 @@ module LeafExpressionConverter = let (|ConvNullableUInt16Q|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Nullable.uint16 x)) let (|ConvNullableUInt32Q|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Nullable.uint32 x)) let (|ConvNullableUInt64Q|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Nullable.uint64 x)) - // LINQ expressions can't do native integer operations, so we don't convert these - //let (|ConvNullableIntPtrQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Nullable.nativeint x)) - //let (|ConvNullableUIntPtrQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Nullable.unativeint x)) - + let (|ConvNullableIntPtrQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Nullable.nativeint x)) + let (|ConvNullableUIntPtrQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Nullable.unativeint x)) let (|UnboxGeneric|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> LanguagePrimitives.IntrinsicFunctions.UnboxGeneric x)) let (|TypeTestGeneric|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> LanguagePrimitives.IntrinsicFunctions.TypeTestGeneric x)) @@ -226,6 +390,8 @@ module LeafExpressionConverter = let (|CheckedConvUInt16Q|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Checked.uint16 x)) let (|CheckedConvUInt32Q|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Checked.uint32 x)) let (|CheckedConvUInt64Q|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Checked.uint64 x)) + let (|CheckedConvIntPtrQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Checked.nativeint x)) + let (|CheckedConvUIntPtrQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Checked.unativeint x)) let (|ImplicitExpressionConversionHelperQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> ImplicitExpressionConversionHelper x)) let (|MemberInitializationHelperQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> MemberInitializationHelper x)) let (|NewAnonymousObjectHelperQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> NewAnonymousObjectHelper x)) @@ -287,7 +453,7 @@ module LeafExpressionConverter = | Patterns.Value(x, ty) -> Expression.Constant(x, ty) |> asExpr - | UnboxGeneric(_, [toTy], [x]) + | UnboxGeneric(_, GenericArgs [|toTy|], [x]) | Patterns.Coerce(x, toTy) -> let converted = ConvExprToLinqInContext env x @@ -299,7 +465,7 @@ module LeafExpressionConverter = | Patterns.TypeTest(x, toTy) -> Expression.TypeIs(ConvExprToLinqInContext env x, toTy) |> asExpr - | TypeTestGeneric(_, [toTy], [x]) -> + | TypeTestGeneric(_, GenericArgs [|toTy|], [x]) -> Expression.TypeIs(ConvExprToLinqInContext env x, toTy) |> asExpr // Expr.*Get @@ -355,147 +521,115 @@ module LeafExpressionConverter = let props = ctor.DeclaringType.GetProperties() Expression.New(ctor, argsR, [| for p in props -> (p :> MemberInfo) |]) |> asExpr - // Do the same thing as C# compiler for string addition - | PlusQ (_, [ty1; ty2; ty3], [x1; x2]) when (ty1 = typeof) && (ty2 = typeof) && (ty3 = typeof) -> + | PlusQ (_, GenericArgs [|ty1; ty2; ty3|], [x1; x2]) when ty1 = typeof && ty2 = typeof && ty3 = typeof -> Expression.Add(ConvExprToLinqInContext env x1, ConvExprToLinqInContext env x2, StringConcat) |> asExpr - | GenericEqualityQ _ - | EqualsQ _ -> transBinOp inp env false args false Expression.Equal - | NotEqQ _ -> transBinOp inp env false args false Expression.NotEqual - | GreaterQ _ -> transBinOp inp env false args false Expression.GreaterThan - | GreaterEqQ _ -> transBinOp inp env false args false Expression.GreaterThanOrEqual - | LessQ _ -> transBinOp inp env false args false Expression.LessThan - | LessEqQ _ -> transBinOp inp env false args false Expression.LessThanOrEqual - | NotQ (_, _, [x1]) -> Expression.Not(ConvExprToLinqInContext env x1) |> asExpr - - | StaticEqualsQ _ -> transBinOp inp env false args false Expression.Equal - | StaticNotEqQ _ -> transBinOp inp env false args false Expression.NotEqual - | StaticGreaterQ _ -> transBinOp inp env false args false Expression.GreaterThan - | StaticGreaterEqQ _ -> transBinOp inp env false args false Expression.GreaterThanOrEqual - | StaticLessQ _ -> transBinOp inp env false args false Expression.LessThan - | StaticLessEqQ _ -> transBinOp inp env false args false Expression.LessThanOrEqual - - | NullableEqualsQ _ -> transBinOp inp env false args true Expression.Equal - | NullableNotEqQ _ -> transBinOp inp env false args true Expression.NotEqual - | NullableGreaterQ _ -> transBinOp inp env false args true Expression.GreaterThan - | NullableGreaterEqQ _ -> transBinOp inp env false args true Expression.GreaterThanOrEqual - | NullableLessQ _ -> transBinOp inp env false args true Expression.LessThan - | NullableLessEqQ _ -> transBinOp inp env false args true Expression.LessThanOrEqual - - | EqualsNullableQ _ -> transBinOp inp env true args false Expression.Equal - | NotEqNullableQ _ -> transBinOp inp env true args false Expression.NotEqual - | GreaterNullableQ _ -> transBinOp inp env true args false Expression.GreaterThan - | GreaterEqNullableQ _ -> transBinOp inp env true args false Expression.GreaterThanOrEqual - | LessNullableQ _ -> transBinOp inp env true args false Expression.LessThan - | LessEqNullableQ _ -> transBinOp inp env true args false Expression.LessThanOrEqual - - | NullableEqualsNullableQ _ -> transBinOp inp env false args false Expression.Equal - | NullableNotEqNullableQ _ -> transBinOp inp env false args false Expression.NotEqual - | NullableGreaterNullableQ _ -> transBinOp inp env false args false Expression.GreaterThan - | NullableGreaterEqNullableQ _ -> transBinOp inp env false args false Expression.GreaterThanOrEqual - | NullableLessNullableQ _ -> transBinOp inp env false args false Expression.LessThan - | NullableLessEqNullableQ _ -> transBinOp inp env false args false Expression.LessThanOrEqual + // LanguagePrimitives.PhysicalEquality's generic constraint of both sides being the same reference type is already sufficient for Linq Expressions' requirements + | PhysicalEqualityQ (_, m, [x1; x2]) -> transBoolOpNoWitness (fun _ -> true) env false x1 x2 false (fun (l, r, _, _) -> Expression.ReferenceEqual(l, r)) m + | GenericEqualityQ (_, m, [x1; x2]) + | EqualsQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsStructurallyEquatable env false x1 x2 false Expression.Equal m + | NotEqQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsStructurallyEquatable env false x1 x2 false Expression.NotEqual m + | GreaterQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env false x1 x2 false Expression.GreaterThan m + | GreaterEqQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env false x1 x2 false Expression.GreaterThanOrEqual m + | LessQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env false x1 x2 false Expression.LessThan m + | LessEqQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env false x1 x2 false Expression.LessThanOrEqual m + | NotQ (_, _, [x1]) -> Expression.Not(ConvExprToLinqInContext env x1) |> asExpr + + | StaticEqualsQ (_, _, [x1; x2]) -> transBoolOp isLinqExpressionsEquatable inp env x1 x2 Expression.Equal (methodhandleof (fun (x, y) -> LanguagePrimitives.EqualityDynamic x y)) + | StaticNotEqQ (_, _, [x1; x2]) -> transBoolOp isLinqExpressionsEquatable inp env x1 x2 Expression.NotEqual (methodhandleof (fun (x, y) -> LanguagePrimitives.InequalityDynamic x y)) + | StaticGreaterQ (_, _, [x1; x2]) -> transBoolOp isLinqExpressionsComparable inp env x1 x2 Expression.GreaterThan (methodhandleof (fun (x, y) -> LanguagePrimitives.GreaterThanDynamic x y)) + | StaticGreaterEqQ (_, _, [x1; x2]) -> transBoolOp isLinqExpressionsComparable inp env x1 x2 Expression.GreaterThanOrEqual (methodhandleof (fun (x, y) -> LanguagePrimitives.GreaterThanOrEqualDynamic x y)) + | StaticLessQ (_, _, [x1; x2]) -> transBoolOp isLinqExpressionsComparable inp env x1 x2 Expression.LessThan (methodhandleof (fun (x, y) -> LanguagePrimitives.LessThanDynamic x y)) + | StaticLessEqQ (_, _, [x1; x2]) -> transBoolOp isLinqExpressionsComparable inp env x1 x2 Expression.LessThanOrEqual (methodhandleof (fun (x, y) -> LanguagePrimitives.LessThanOrEqualDynamic x y)) + + | NullableEqualsQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsStructurallyEquatable env false x1 x2 true Expression.Equal m + | NullableNotEqQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsStructurallyEquatable env false x1 x2 true Expression.NotEqual m + | NullableGreaterQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env false x1 x2 true Expression.GreaterThan m + | NullableGreaterEqQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env false x1 x2 true Expression.GreaterThanOrEqual m + | NullableLessQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env false x1 x2 true Expression.LessThan m + | NullableLessEqQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env false x1 x2 true Expression.LessThanOrEqual m + + | EqualsNullableQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsStructurallyEquatable env true x1 x2 false Expression.Equal m + | NotEqNullableQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsStructurallyEquatable env true x1 x2 false Expression.NotEqual m + | GreaterNullableQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env true x1 x2 false Expression.GreaterThan m + | GreaterEqNullableQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env true x1 x2 false Expression.GreaterThanOrEqual m + | LessNullableQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env true x1 x2 false Expression.LessThan m + | LessEqNullableQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env true x1 x2 false Expression.LessThanOrEqual m + + | NullableEqualsNullableQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsStructurallyEquatable env false x1 x2 false Expression.Equal m + | NullableNotEqNullableQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsStructurallyEquatable env false x1 x2 false Expression.NotEqual m + | NullableGreaterNullableQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env false x1 x2 false Expression.GreaterThan m + | NullableGreaterEqNullableQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env false x1 x2 false Expression.GreaterThanOrEqual m + | NullableLessNullableQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env false x1 x2 false Expression.LessThan m + | NullableLessEqNullableQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env false x1 x2 false Expression.LessThanOrEqual m // Detect the F# quotation encoding of decimal literals | MakeDecimalQ (_, _, [Int32 lo; Int32 med; Int32 hi; Bool isNegative; Byte scale]) -> Expression.Constant (new System.Decimal(lo, med, hi, isNegative, scale)) |> asExpr - | NegQ (_, _, [x1]) -> Expression.Negate(ConvExprToLinqInContext env x1) |> asExpr - | PlusQ _ -> transBinOp inp env false args false Expression.Add - | DivideQ _ -> transBinOp inp env false args false Expression.Divide - | MinusQ _ -> transBinOp inp env false args false Expression.Subtract - | MultiplyQ _ -> transBinOp inp env false args false Expression.Multiply - | ModuloQ _ -> transBinOp inp env false args false Expression.Modulo - - | ShiftLeftQ _ -> transBinOp inp env false args false Expression.LeftShift - | ShiftRightQ _ -> transBinOp inp env false args false Expression.RightShift - | BitwiseAndQ _ -> transBinOp inp env false args false Expression.And - | BitwiseOrQ _ -> transBinOp inp env false args false Expression.Or - | BitwiseXorQ _ -> transBinOp inp env false args false Expression.ExclusiveOr - | BitwiseNotQ (_, _, [x1]) -> Expression.Not(ConvExprToLinqInContext env x1) |> asExpr + | NegQ (_, _, [x]) -> transUnaryOp isLinqExpressionsArithmeticTypeButNotUnsignedInt inp env x Expression.Negate (methodhandleof (fun x -> LanguagePrimitives.UnaryNegationDynamic x)) + | PlusQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 false Expression.Add (methodhandleof (fun (x, y) -> LanguagePrimitives.AdditionDynamic x y)) + | MinusQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 false Expression.Subtract (methodhandleof (fun (x, y) -> LanguagePrimitives.SubtractionDynamic x y)) + | MultiplyQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 false Expression.Multiply (methodhandleof (fun (x, y) -> LanguagePrimitives.MultiplyDynamic x y)) + | DivideQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 false Expression.Divide (methodhandleof (fun (x, y) -> LanguagePrimitives.DivisionDynamic x y)) + | ModuloQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 false Expression.Modulo (methodhandleof (fun (x, y) -> LanguagePrimitives.ModulusDynamic x y)) + + | ShiftLeftQ (_, _, [x1; x2]) -> transShiftOp inp env false x1 x2 false Expression.LeftShift (methodhandleof (fun (x, y) -> LanguagePrimitives.LeftShiftDynamic x y)) + | ShiftRightQ (_, _, [x1; x2]) -> transShiftOp inp env false x1 x2 false Expression.RightShift (methodhandleof (fun (x, y) -> LanguagePrimitives.RightShiftDynamic x y)) + | BitwiseAndQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsIntegerOrBool inp env false x1 x2 false Expression.And (methodhandleof (fun (x, y) -> LanguagePrimitives.BitwiseAndDynamic x y)) + | BitwiseOrQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsIntegerOrBool inp env false x1 x2 false Expression.Or (methodhandleof (fun (x, y) -> LanguagePrimitives.BitwiseOrDynamic x y)) + | BitwiseXorQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsIntegerOrBool inp env false x1 x2 false Expression.ExclusiveOr (methodhandleof (fun (x, y) -> LanguagePrimitives.ExclusiveOrDynamic x y)) + | BitwiseNotQ (_, _, [x]) -> transUnaryOp isLinqExpressionsIntegerOrBool inp env x Expression.Not (methodhandleof (fun x -> LanguagePrimitives.LogicalNotDynamic x)) - | CheckedNeg (_, _, [x1]) -> Expression.NegateChecked(ConvExprToLinqInContext env x1) |> asExpr - | CheckedPlusQ _ -> transBinOp inp env false args false Expression.AddChecked - | CheckedMinusQ _ -> transBinOp inp env false args false Expression.SubtractChecked - | CheckedMultiplyQ _ -> transBinOp inp env false args false Expression.MultiplyChecked + | CheckedNeg (_, _, [x]) -> transUnaryOp isLinqExpressionsArithmeticTypeButNotUnsignedInt inp env x Expression.NegateChecked (methodhandleof (fun x -> LanguagePrimitives.CheckedUnaryNegationDynamic x)) + | CheckedPlusQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 false Expression.AddChecked (methodhandleof (fun (x, y) -> LanguagePrimitives.CheckedAdditionDynamic x y)) + | CheckedMinusQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 false Expression.SubtractChecked (methodhandleof (fun (x, y) -> LanguagePrimitives.CheckedSubtractionDynamic x y)) + | CheckedMultiplyQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 false Expression.MultiplyChecked (methodhandleof (fun (x, y) -> LanguagePrimitives.CheckedMultiplyDynamic x y)) - | NullablePlusQ _ -> transBinOp inp env false args true Expression.Add - | PlusNullableQ _ -> transBinOp inp env true args false Expression.Add - | NullablePlusNullableQ _ -> transBinOp inp env false args false Expression.Add + | NullablePlusQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 true Expression.Add (methodhandleof (fun (x, y) -> LanguagePrimitives.AdditionDynamic x y)) + | PlusNullableQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env true x1 x2 false Expression.Add (methodhandleof (fun (x, y) -> LanguagePrimitives.AdditionDynamic x y)) + | NullablePlusNullableQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 false Expression.Add (methodhandleof (fun (x, y) -> LanguagePrimitives.AdditionDynamic x y)) - | NullableMinusQ _ -> transBinOp inp env false args true Expression.Subtract - | MinusNullableQ _ -> transBinOp inp env true args false Expression.Subtract - | NullableMinusNullableQ _ -> transBinOp inp env false args false Expression.Subtract + | NullableMinusQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 true Expression.Subtract (methodhandleof (fun (x, y) -> LanguagePrimitives.SubtractionDynamic x y)) + | MinusNullableQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env true x1 x2 false Expression.Subtract (methodhandleof (fun (x, y) -> LanguagePrimitives.SubtractionDynamic x y)) + | NullableMinusNullableQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 false Expression.Subtract (methodhandleof (fun (x, y) -> LanguagePrimitives.SubtractionDynamic x y)) - | NullableMultiplyQ _ -> transBinOp inp env false args true Expression.Multiply - | MultiplyNullableQ _ -> transBinOp inp env true args false Expression.Multiply - | NullableMultiplyNullableQ _ -> transBinOp inp env false args false Expression.Multiply + | NullableMultiplyQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 true Expression.Multiply (methodhandleof (fun (x, y) -> LanguagePrimitives.MultiplyDynamic x y)) + | MultiplyNullableQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env true x1 x2 false Expression.Multiply (methodhandleof (fun (x, y) -> LanguagePrimitives.MultiplyDynamic x y)) + | NullableMultiplyNullableQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 false Expression.Multiply (methodhandleof (fun (x, y) -> LanguagePrimitives.MultiplyDynamic x y)) - | NullableDivideQ _ -> transBinOp inp env false args true Expression.Divide - | DivideNullableQ _ -> transBinOp inp env true args false Expression.Divide - | NullableDivideNullableQ _ -> transBinOp inp env false args false Expression.Divide + | NullableDivideQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 true Expression.Divide (methodhandleof (fun (x, y) -> LanguagePrimitives.DivisionDynamic x y)) + | DivideNullableQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env true x1 x2 false Expression.Divide (methodhandleof (fun (x, y) -> LanguagePrimitives.DivisionDynamic x y)) + | NullableDivideNullableQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 false Expression.Divide (methodhandleof (fun (x, y) -> LanguagePrimitives.DivisionDynamic x y)) - | NullableModuloQ _ -> transBinOp inp env false args true Expression.Modulo - | ModuloNullableQ _ -> transBinOp inp env true args false Expression.Modulo - | NullableModuloNullableQ _ -> transBinOp inp env false args false Expression.Modulo - - | ConvNullableCharQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableDecimalQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableFloatQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableDoubleQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableFloat32Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableSingleQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableSByteQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableInt8Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableInt16Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableInt32Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableIntQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableInt64Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableByteQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableUInt8Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableUInt16Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableUInt32Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableUInt64Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - // LINQ expressions can't do native integer operations, so we don't convert these - //| ConvNullableIntPtrQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - //| ConvNullableUIntPtrQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - - | ConvCharQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvDecimalQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvFloatQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvDoubleQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvFloat32Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvSingleQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvSByteQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvInt8Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvInt16Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvInt32Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvIntQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvInt64Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvByteQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvUInt8Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvUInt16Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvUInt32Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvUInt64Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - - | CheckedConvCharQ (_, _, [x1]) -> Expression.ConvertChecked(ConvExprToLinqInContext env x1, typeof) |> asExpr - | CheckedConvSByteQ (_, _, [x1]) -> Expression.ConvertChecked(ConvExprToLinqInContext env x1, typeof) |> asExpr - | CheckedConvInt8Q (_, _, [x1]) -> Expression.ConvertChecked(ConvExprToLinqInContext env x1, typeof) |> asExpr - | CheckedConvInt16Q (_, _, [x1]) -> Expression.ConvertChecked(ConvExprToLinqInContext env x1, typeof) |> asExpr - | CheckedConvInt32Q (_, _, [x1]) -> Expression.ConvertChecked(ConvExprToLinqInContext env x1, typeof) |> asExpr - | CheckedConvInt64Q (_, _, [x1]) -> Expression.ConvertChecked(ConvExprToLinqInContext env x1, typeof) |> asExpr - | CheckedConvByteQ (_, _, [x1]) -> Expression.ConvertChecked(ConvExprToLinqInContext env x1, typeof) |> asExpr - | CheckedConvUInt8Q (_, _, [x1]) -> Expression.ConvertChecked(ConvExprToLinqInContext env x1, typeof) |> asExpr - | CheckedConvUInt16Q (_, _, [x1]) -> Expression.ConvertChecked(ConvExprToLinqInContext env x1, typeof) |> asExpr - | CheckedConvUInt32Q (_, _, [x1]) -> Expression.ConvertChecked(ConvExprToLinqInContext env x1, typeof) |> asExpr - | CheckedConvUInt64Q (_, _, [x1]) -> Expression.ConvertChecked(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ArrayLookupQ (_, [_; _; _], [x1; x2]) -> + | NullableModuloQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 true Expression.Modulo (methodhandleof (fun (x, y) -> LanguagePrimitives.ModulusDynamic x y)) + | ModuloNullableQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env true x1 x2 false Expression.Modulo (methodhandleof (fun (x, y) -> LanguagePrimitives.ModulusDynamic x y)) + | NullableModuloNullableQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 false Expression.Modulo (methodhandleof (fun (x, y) -> LanguagePrimitives.ModulusDynamic x y)) + + | ConvNullableCharQ (_, _, [x]) | ConvNullableDecimalQ (_, _, [x]) | ConvNullableFloatQ (_, _, [x]) | ConvNullableDoubleQ (_, _, [x]) -> transConv inp env false x + | ConvNullableFloat32Q (_, _, [x]) | ConvNullableSingleQ (_, _, [x]) | ConvNullableSByteQ (_, _, [x]) | ConvNullableInt8Q (_, _, [x]) -> transConv inp env false x + | ConvNullableInt16Q (_, _, [x]) | ConvNullableInt32Q (_, _, [x]) | ConvNullableIntQ (_, _, [x]) | ConvNullableInt64Q (_, _, [x]) -> transConv inp env false x + | ConvNullableByteQ (_, _, [x]) | ConvNullableUInt8Q (_, _, [x]) | ConvNullableUInt16Q (_, _, [x]) | ConvNullableUInt32Q (_, _, [x]) -> transConv inp env false x + | ConvNullableUInt64Q (_, _, [x]) | ConvNullableIntPtrQ (_, _, [x]) | ConvNullableUIntPtrQ (_, _, [x]) -> transConv inp env false x + + | ConvCharQ (_, _, [x]) | ConvDecimalQ (_, _, [x]) | ConvFloatQ (_, _, [x]) | ConvDoubleQ (_, _, [x]) -> transConv inp env false x + | ConvFloat32Q (_, _, [x]) | ConvSingleQ (_, _, [x]) | ConvSByteQ (_, _, [x]) | ConvInt8Q (_, _, [x]) -> transConv inp env false x + | ConvInt16Q (_, _, [x]) | ConvInt32Q (_, _, [x]) | ConvIntQ (_, _, [x]) | ConvInt64Q (_, _, [x]) -> transConv inp env false x + | ConvByteQ (_, _, [x]) | ConvUInt8Q (_, _, [x]) | ConvUInt16Q (_, _, [x]) | ConvUInt32Q (_, _, [x]) -> transConv inp env false x + | ConvUInt64Q (_, _, [x]) | ConvIntPtrQ (_, _, [x]) | ConvUIntPtrQ (_, _, [x]) -> transConv inp env false x + + | CheckedConvCharQ (_, _, [x]) | CheckedConvSByteQ (_, _, [x]) | CheckedConvInt8Q (_, _, [x]) | CheckedConvInt16Q (_, _, [x]) -> transConv inp env true x + | CheckedConvInt32Q (_, _, [x]) | CheckedConvInt64Q (_, _, [x]) | CheckedConvByteQ (_, _, [x]) | CheckedConvUInt8Q (_, _, [x]) -> transConv inp env true x + | CheckedConvUInt16Q (_, _, [x]) | CheckedConvUInt32Q (_, _, [x]) | CheckedConvUInt64Q (_, _, [x]) | CheckedConvIntPtrQ (_, _, [x]) -> transConv inp env true x + | CheckedConvUIntPtrQ (_, _, [x]) -> transConv inp env true x + + | ArrayLookupQ (_, GenericArgs [|_; _; _|], [x1; x2]) -> Expression.ArrayIndex(ConvExprToLinqInContext env x1, ConvExprToLinqInContext env x2) |> asExpr // Throw away markers inserted to satisfy C#'s design where they pass an argument // or type T to an argument expecting Expression. - | ImplicitExpressionConversionHelperQ (_, [_], [x1]) -> ConvExprToLinqInContext env x1 + | ImplicitExpressionConversionHelperQ (_, GenericArgs [|_|], [x1]) -> ConvExprToLinqInContext env x1 // Use witnesses if they are available | CallWithWitnesses (objArgOpt, _, minfo2, witnessArgs, args) -> @@ -593,11 +727,11 @@ module LeafExpressionConverter = | NullableConstruction arg -> Expression.Convert(ConvExprToLinqInContext env arg, x.Type) |> asExpr | _ -> Expression.New(ctorInfo, ConvExprsToLinq env args) |> asExpr - | Patterns.NewDelegate(dty, vs, b) -> + | Patterns.NewDelegate(delegateTy, vs, b) -> let vsP = List.map ConvVarToLinq vs let env = {env with varEnv = List.foldBack2 (fun (v:Var) vP -> Map.add v (vP |> asExpr)) vs vsP env.varEnv } let bodyP = ConvExprToLinqInContext env b - Expression.Lambda(dty, bodyP, vsP) |> asExpr + Expression.Lambda(delegateTy, bodyP, vsP) |> asExpr | Patterns.NewTuple args -> let tupTy = @@ -665,15 +799,79 @@ module LeafExpressionConverter = and failConvert inp = raise (new NotSupportedException(Printf.sprintf "Could not convert the following F# Quotation to a LINQ Expression Tree\n--------\n%s\n-------------\n" (inp.ToString()))) - and transBinOp inp env addConvertLeft args addConvertRight (exprErasedConstructor : _ * _ -> _) = - match args with - | [x1; x2] -> - let e1 = ConvExprToLinqInContext env x1 - let e2 = ConvExprToLinqInContext env x2 - let e1 = if addConvertLeft then Expression.Convert(e1, typedefof>.MakeGenericType [| e1.Type |]) |> asExpr else e1 - let e2 = if addConvertRight then Expression.Convert(e2, typedefof>.MakeGenericType [| e2.Type |]) |> asExpr else e2 - exprErasedConstructor(e1, e2) |> asExpr - | _ -> failConvert inp + /// Translate a unary operator + and transUnaryOp linqExpressionsCondition inp env x (exprErasedConstructor: _ * _ -> _) fallback = + let e = ConvExprToLinqInContext env x + if linqExpressionsCondition e.Type then + exprErasedConstructor(e, null) + else + let method = Reflection.MethodInfo.GetMethodFromHandle fallback :?> Reflection.MethodInfo + exprErasedConstructor(e, method.MakeGenericMethod [| getNonNullableType x.Type; getNonNullableType inp.Type |]) + |> asExpr + + /// Translate a shift operator + and transShiftOp inp env addConvertLeft x1 x2 addConvertRight (exprErasedConstructor: _ * _ * _ -> _) fallback = + let e1 = ConvExprToLinqInContext env x1 + let e2 = ConvExprToLinqInContext env x2 + let e1 = if addConvertLeft then Expression.Convert(e1, typedefof>.MakeGenericType [| e1.Type |]) |> asExpr else e1 + let e2 = if addConvertRight then Expression.Convert(e2, typedefof>.MakeGenericType [| e2.Type |]) |> asExpr else e2 + if e1.Type = e2.Type && isLinqExpressionsSimpleShift e1.Type e2.Type then + exprErasedConstructor(e1, e2, null) + else + let method = Reflection.MethodInfo.GetMethodFromHandle fallback :?> Reflection.MethodInfo + exprErasedConstructor(e1, e2, method.MakeGenericMethod [| getNonNullableType x1.Type; getNonNullableType x2.Type; getNonNullableType inp.Type |]) + |> asExpr + + /// Translate a non-shift binary operator that does not return a boolean + and transBinOp linqExpressionsCondition inp env addConvertLeft x1 x2 addConvertRight (exprErasedConstructor: _ * _ * _ -> _) fallback = + let e1 = ConvExprToLinqInContext env x1 + let e2 = ConvExprToLinqInContext env x2 + let e1 = if addConvertLeft then Expression.Convert(e1, typedefof>.MakeGenericType [| e1.Type |]) |> asExpr else e1 + let e2 = if addConvertRight then Expression.Convert(e2, typedefof>.MakeGenericType [| e2.Type |]) |> asExpr else e2 + if e1.Type = e2.Type && linqExpressionsCondition e1.Type then + exprErasedConstructor(e1, e2, null) + else + let method = Reflection.MethodInfo.GetMethodFromHandle fallback :?> Reflection.MethodInfo + exprErasedConstructor(e1, e2, method.MakeGenericMethod [| getNonNullableType x1.Type; getNonNullableType x2.Type; getNonNullableType inp.Type |]) + |> asExpr + + // The F# boolean structural equality / comparison operators do not take witnesses and the referenced methods are callable directly + /// Translate a non-shift binary operator without witnesses that does not return a boolean + and transBoolOpNoWitness linqExpressionsCondition env addConvertLeft x1 x2 addConvertRight (exprErasedConstructor: _ * _ * _ * _ -> _) method = + let e1 = ConvExprToLinqInContext env x1 + let e2 = ConvExprToLinqInContext env x2 + let e1' = if addConvertLeft then Expression.Convert(e1, typedefof>.MakeGenericType [| e1.Type |]) |> asExpr else e1 + let e2' = if addConvertRight then Expression.Convert(e2, typedefof>.MakeGenericType [| e2.Type |]) |> asExpr else e2 + if e1'.Type = e2'.Type && linqExpressionsCondition e1.Type then + // The false for (liftToNull: bool) indicates whether equality operators return a Nullable like in VB.NET (null when either argument is null) instead of bool like in C# (nulls equate to nulls). F# follows C# here. + exprErasedConstructor(e1', e2', false, null) + else + exprErasedConstructor(e1, e2, false, method) + |> asExpr + + // But the static boolean operators do take witnesses! + /// Translate a non-shift binary operator that returns a boolean + and transBoolOp linqExpressionsCondition inp env x1 x2 (exprErasedConstructor: _ * _ * _ * _ -> _) fallback = + let e1 = ConvExprToLinqInContext env x1 + let e2 = ConvExprToLinqInContext env x2 + if e1.Type = e2.Type && linqExpressionsCondition e1.Type then + // The false for (liftToNull: bool) indicates whether equality operators return a Nullable like in VB.NET (null when either argument is null) instead of bool like in C# (nulls equate to nulls). F# follows C# here. + exprErasedConstructor(e1, e2, false, null) + else + let method = Reflection.MethodInfo.GetMethodFromHandle fallback :?> Reflection.MethodInfo + exprErasedConstructor(e1, e2, false, method.MakeGenericMethod [| getNonNullableType x1.Type; getNonNullableType x2.Type; getNonNullableType inp.Type |]) + |> asExpr + + /// Translate a conversion operator + and transConv (inp: Expr) env isChecked x = + let e = ConvExprToLinqInContext env x + let exprErasedConstructor: _ * _ * _ -> _ = if isChecked then Expression.ConvertChecked else Expression.Convert + if isLinqExpressionsConvertible e.Type inp.Type then + exprErasedConstructor(e, inp.Type, null) + else + let method = Reflection.MethodInfo.GetMethodFromHandle (if isChecked then methodhandleof (fun x -> LanguagePrimitives.CheckedExplicitDynamic x) else methodhandleof (fun x -> LanguagePrimitives.ExplicitDynamic x)) :?> Reflection.MethodInfo + exprErasedConstructor(e, inp.Type, method.MakeGenericMethod [| getNonNullableType x.Type; getNonNullableType inp.Type |]) + |> asExpr and ConvObjArg env objOpt coerceTo : Expression = match objOpt with @@ -716,6 +914,4 @@ module LeafExpressionConverter = d.DynamicInvoke [| box () |] with :? System.Reflection.TargetInvocationException as exn -> raise exn.InnerException -#endif - - +#endif \ No newline at end of file diff --git a/src/FSharp.Core/Linq.fsi b/src/FSharp.Core/Linq.fsi index cfe61b4d1eb..13f3fa4187e 100644 --- a/src/FSharp.Core/Linq.fsi +++ b/src/FSharp.Core/Linq.fsi @@ -88,4 +88,4 @@ module LeafExpressionConverter = val SubstHelperRaw: Expr * Var[] * obj[] -> Expr val internal (|SpecificCallToMethod|_|): - System.RuntimeMethodHandle -> (Expr -> (Expr option * Type list * Expr list) option) + System.RuntimeMethodHandle -> (Expr -> (Expr option * Reflection.MethodInfo * Expr list) option) diff --git a/src/FSharp.Core/Query.fs b/src/FSharp.Core/Query.fs index 2701df53b1c..ae11d3835a1 100644 --- a/src/FSharp.Core/Query.fs +++ b/src/FSharp.Core/Query.fs @@ -314,26 +314,27 @@ module Query = match prop.GetGetMethod true with | null -> None | v -> Some v + let (|GenericArgs|) (minfo: MethodInfo) = minfo.GetGenericArguments() |> Array.toList // Match 'f x' let (|SpecificCall1|_|) q = let (|CallQ|_|) = (|SpecificCallToMethod|_|) q function - | CallQ (Some builderObj, tyargs, [arg1]) -> Some(builderObj, tyargs, arg1) + | CallQ (Some builderObj, GenericArgs tyargs, [arg1]) -> Some(builderObj, tyargs, arg1) | _ -> None // Match 'f x y' or 'f (x, y)' let (|SpecificCall2|_|) q = let (|CallQ|_|) = (|SpecificCallToMethod|_|) q function - | CallQ (Some builderObj, tyargs, [arg1; arg2]) -> Some(builderObj, tyargs, arg1, arg2) + | CallQ (Some builderObj, GenericArgs tyargs, [arg1; arg2]) -> Some(builderObj, tyargs, arg1, arg2) | _ -> None // Match 'f x y z' or 'f (x, y, z)' let (|SpecificCall3|_|) q = let (|CallQ|_|) = (|SpecificCallToMethod|_|) q function - | CallQ (Some builderObj, tyargs, [arg1; arg2; arg3]) -> Some(builderObj, tyargs, arg1, arg2, arg3) + | CallQ (Some builderObj, GenericArgs tyargs, [arg1; arg2; arg3]) -> Some(builderObj, tyargs, arg1, arg2, arg3) | _ -> None /// (fun (x, y) -> z) is represented as 'fun p -> let x = p#0 let y = p#1' etc. @@ -1286,7 +1287,7 @@ module Query = // rewrite has had the custom operator translation mechanism applied. In this case, the // body of the "for" will simply contain "yield". - | CallQueryBuilderFor (_, [_; qTy; immutResElemTy; _], [immutSource; Lambda(immutSelectorVar, immutSelector) ]) -> + | CallQueryBuilderFor (_, GenericArgs [_; qTy; immutResElemTy; _], [immutSource; Lambda(immutSelectorVar, immutSelector) ]) -> let mutSource, sourceConv = TransInner CanEliminate.Yes check immutSource @@ -1467,7 +1468,7 @@ module Query = | _ -> GroupingConv (immutKeySelector.Type, immutElementSelector.Type, selectorConv) TransInnerResult.Other(MakeGroupValBy(qTyIsIQueryable qTy, mutVar1.Type, mutKeySelector.Type, mutElementSelector.Type, mutSource, mutVar2, mutKeySelector, mutVar1, mutElementSelector)), conv - | CallJoin(_, [_; qTy; _; _; _], + | CallJoin(_, GenericArgs [_; qTy; _; _; _], [ immutOuterSource immutInnerSource Lambda(immutOuterKeyVar, immutOuterKeySelector) @@ -1491,7 +1492,7 @@ module Query = TransInnerResult.Other joinExpr, elementSelectorConv | CallGroupJoin - (_, [_; qTy; _; _; _], + (_, GenericArgs [_; qTy; _; _; _], [ immutOuterSource immutInnerSource Lambda(immutOuterKeyVar, immutOuterKeySelector) @@ -1517,7 +1518,7 @@ module Query = TransInnerResult.Other joinExpr, elementSelectorConv | CallLeftOuterJoin - (_, [ _; qTy; immutInnerSourceTy; _; _], + (_, GenericArgs [ _; qTy; immutInnerSourceTy; _; _], [ immutOuterSource immutInnerSource Lambda(immutOuterKeyVar, immutOuterKeySelector) diff --git a/src/FSharp.Core/prim-types.fs b/src/FSharp.Core/prim-types.fs index 40b4941045b..1d5dcc28d05 100644 --- a/src/FSharp.Core/prim-types.fs +++ b/src/FSharp.Core/prim-types.fs @@ -2518,7 +2518,6 @@ namespace Microsoft.FSharp.Core // this condition is used whenever ^T is resolved to a nominal type when ^T : ^T = (^T : (static member Zero : ^T) ()) - let inline GenericOne< ^T when ^T : (static member One : ^T) > : ^T = GenericOneDynamic<(^T)>() when ^T : int32 = 1 @@ -2541,10 +2540,21 @@ namespace Microsoft.FSharp.Core when ^T : ^T = (^T : (static member One : ^T) ()) type Type with - + /// Gets a single static non-conversion operator or method by types member inline this.GetSingleStaticMethodByTypes(name: string, parameterTypes: Type[]) = - let staticBindingFlags = (# "" 0b111000 : BindingFlags #) // BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic - this.GetMethod(name, staticBindingFlags, null, parameterTypes, null ) + let staticBindingFlags = (# "" 0b111000 : BindingFlags #) // BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic + this.GetMethod(name, staticBindingFlags, null, parameterTypes, null ) + + // Logic based on https://github.com/dotnet/runtime/blob/f66b142980b2b0df738158457458e003944dc7f6/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/TypeUtils.cs#L662 + /// Gets a single static conversion operator by types + member inline this.GetSingleStaticConversionOperatorByTypes(fromType : Type, toType : Type) = + let staticBindingFlags = (# "" 0b111000 : BindingFlags #) // BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic + let mutable ret = null + for mi in this.GetMethods staticBindingFlags do + if (System.String.Equals(mi.Name, "op_Implicit") || System.String.Equals(mi.Name, "op_Explicit")) && + (let p = mi.GetParameters() in p.Length = 1 && (get p 0).ParameterType.IsEquivalentTo fromType) && mi.ReturnType.IsEquivalentTo toType then + ret <- mi + ret let UnaryDynamicImpl nm : ('T -> 'U) = let aty = typeof<'T> @@ -2567,7 +2577,14 @@ namespace Microsoft.FSharp.Core match meth with | null -> - let ameth = aty.GetSingleStaticMethodByTypes(opName, [| aty |]) + let ameth = + if System.String.Equals(opName, "op_Explicit") then + let aty2 = typeof<'U> + match aty.GetSingleStaticConversionOperatorByTypes(aty, aty2) with + | null -> aty2.GetSingleStaticConversionOperatorByTypes(aty, aty2) + | ameth -> ameth + else + aty.GetSingleStaticMethodByTypes(opName, [| aty |]) match ameth with | null -> raise (NotSupportedException (SR.GetString(SR.dyInvOpAddCoerce))) | res -> @@ -2633,6 +2650,7 @@ namespace Microsoft.FSharp.Core elif type3eq<'T1, 'T2, 'U, uint16> then convPrim<_,'U> (# "conv.u2" (# "sub" (convPrim<_,uint16> x) (convPrim<_,uint16> y) : uint32 #) : uint16 #) elif type3eq<'T1, 'T2, 'U, sbyte> then convPrim<_,'U> (# "conv.i1" (# "sub" (convPrim<_,sbyte> x) (convPrim<_,sbyte> y) : int32 #) : sbyte #) elif type3eq<'T1, 'T2, 'U, byte> then convPrim<_,'U> (# "conv.u1" (# "sub" (convPrim<_,byte> x) (convPrim<_,byte> y) : uint32 #) : byte #) + elif type3eq<'T1, 'T2, 'U, char> then convPrim<_,'U> (# "conv.u1" (# "sub" (convPrim<_,char> x) (convPrim<_,char> y) : uint32 #) : char #) elif type3eq<'T1, 'T2, 'U, decimal> then convPrim<_,'U> (Decimal.op_Subtraction(convPrim<_,decimal> x, convPrim<_,decimal> y)) else BinaryOpDynamicImplTable.Invoke "op_Subtraction" x y @@ -2715,7 +2733,7 @@ namespace Microsoft.FSharp.Core elif type3eq<'T1, 'T2, 'U, unativeint> then convPrim<_,'U> (# "add.ovf.un" (convPrim<_,unativeint> x) (convPrim<_,unativeint> y) : unativeint #) elif type3eq<'T1, 'T2, 'U, int16> then convPrim<_,'U> (# "conv.ovf.i2" (# "add.ovf" (convPrim<_,int16> x) (convPrim<_,int16> y) : int32 #) : int16 #) elif type3eq<'T1, 'T2, 'U, uint16> then convPrim<_,'U> (# "conv.ovf.u2.un" (# "add.ovf.un" (convPrim<_,uint16> x) (convPrim<_,uint16> y) : uint32 #) : uint16 #) - elif type3eq<'T1, 'T2, 'U, char> then convPrim<_,'U> (# "conv.ovf.u2.un" (# "add.ovf.un" (convPrim<_,char> x) (convPrim<_,char> y) : uint32 #) : uint16 #) + elif type3eq<'T1, 'T2, 'U, char> then convPrim<_,'U> (# "conv.ovf.u2.un" (# "add.ovf.un" (convPrim<_,char> x) (convPrim<_,char> y) : uint32 #) : char #) elif type3eq<'T1, 'T2, 'U, sbyte> then convPrim<_,'U> (# "conv.ovf.i1" (# "add.ovf" (convPrim<_,sbyte> x) (convPrim<_,sbyte> y) : int32 #) : sbyte #) elif type3eq<'T1, 'T2, 'U, byte> then convPrim<_,'U> (# "conv.ovf.u1.un" (# "add.ovf.un" (convPrim<_,byte> x) (convPrim<_,byte> y) : uint32 #) : byte #) elif type3eq<'T1, 'T2, 'U, string> then convPrim<_,'U> (String.Concat(convPrim<_,string> x, convPrim<_,string> y)) @@ -2735,6 +2753,7 @@ namespace Microsoft.FSharp.Core elif type3eq<'T1, 'T2, 'U, unativeint> then convPrim<_,'U> (# "sub.ovf.un" (convPrim<_,unativeint> x) (convPrim<_,unativeint> y) : unativeint #) elif type3eq<'T1, 'T2, 'U, int16> then convPrim<_,'U> (# "conv.ovf.i2" (# "sub.ovf" (convPrim<_,int16> x) (convPrim<_,int16> y) : int32 #) : int16 #) elif type3eq<'T1, 'T2, 'U, uint16> then convPrim<_,'U> (# "conv.ovf.u2.un" (# "sub.ovf.un" (convPrim<_,uint16> x) (convPrim<_,uint16> y) : uint32 #) : uint16 #) + elif type3eq<'T1, 'T2, 'U, char> then convPrim<_,'U> (# "conv.ovf.u2.un" (# "sub.ovf.un" (convPrim<_,char> x) (convPrim<_,char> y) : uint32 #) : char #) elif type3eq<'T1, 'T2, 'U, sbyte> then convPrim<_,'U> (# "conv.ovf.i1" (# "sub.ovf" (convPrim<_,sbyte> x) (convPrim<_,sbyte> y) : int32 #) : sbyte #) elif type3eq<'T1, 'T2, 'U, byte> then convPrim<_,'U> (# "conv.ovf.u1.un" (# "sub.ovf.un" (convPrim<_,byte> x) (convPrim<_,byte> y) : uint32 #) : byte #) elif type3eq<'T1, 'T2, 'U, decimal> then convPrim<_,'U> (Decimal.op_Subtraction(convPrim<_,decimal> x, convPrim<_,decimal> y)) @@ -2866,7 +2885,7 @@ namespace Microsoft.FSharp.Core let ExplicitDynamic<'T, 'U> (value: 'T) : 'U = if typeeq<'U, byte> then if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.u1" (convPrim<_,sbyte> value) : byte #) - elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.u1" (convPrim<_,byte> value) : byte #) + elif typeeq<'T, byte> then convPrim<_,'U> value elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.u1" (convPrim<_,int16> value) : byte #) elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.u1" (convPrim<_,uint16> value) : byte #) elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.u1" (convPrim<_,int32> value) : byte #) @@ -2881,7 +2900,7 @@ namespace Microsoft.FSharp.Core elif typeeq<'T, string> then convPrim<_,'U> (ParseByte (convPrim<_,string> value)) else UnaryOpDynamicImplTable.Invoke "op_Explicit" value elif typeeq<'U, sbyte> then - if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.i1" (convPrim<_,sbyte> value) : sbyte #) + if typeeq<'T, sbyte> then convPrim<_,'U> value elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.i1" (convPrim<_,byte> value) : sbyte #) elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.i1" (convPrim<_,int16> value) : sbyte #) elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.i1" (convPrim<_,uint16> value) : sbyte #) @@ -2900,7 +2919,7 @@ namespace Microsoft.FSharp.Core if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.u2" (convPrim<_,sbyte> value) : uint16 #) elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.u2" (convPrim<_,byte> value) : uint16 #) elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.u2" (convPrim<_,int16> value) : uint16 #) - elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.u2" (convPrim<_,uint16> value) : uint16 #) + elif typeeq<'T, uint16> then convPrim<_,'U> value elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.u2" (convPrim<_,int32> value) : uint16 #) elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.u2" (convPrim<_,uint32> value) : uint16 #) elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.u2" (convPrim<_,int64> value) : uint16 #) @@ -2909,13 +2928,13 @@ namespace Microsoft.FSharp.Core elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.u2" (convPrim<_,unativeint> value) : uint16 #) elif typeeq<'T, float> then convPrim<_,'U> (# "conv.u2" (convPrim<_,float> value) : uint16 #) elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.u2" (convPrim<_,float32> value) : uint16 #) - elif typeeq<'T, char> then convPrim<_,'U> (# "conv.u2" (convPrim<_,char> value) : uint16 #) + elif typeeq<'T, char> then convPrim<_,'U> (# "" (convPrim<_,char> value) : uint16 #) elif typeeq<'T, string> then convPrim<_,'U> (ParseUInt16 (convPrim<_,string> value)) else UnaryOpDynamicImplTable.Invoke "op_Explicit" value elif typeeq<'U, int16> then if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.i2" (convPrim<_,sbyte> value) : int16 #) elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.i2" (convPrim<_,byte> value) : int16 #) - elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.i2" (convPrim<_,int16> value) : int16 #) + elif typeeq<'T, int16> then convPrim<_,'U> value elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.i2" (convPrim<_,uint16> value) : int16 #) elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.i2" (convPrim<_,int32> value) : int16 #) elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.i2" (convPrim<_,uint32> value) : int16 #) @@ -2934,7 +2953,7 @@ namespace Microsoft.FSharp.Core elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.u4" (convPrim<_,int16> value) : uint32 #) elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.u4" (convPrim<_,uint16> value) : uint32 #) elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.u4" (convPrim<_,int32> value) : uint32 #) - elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.u4" (convPrim<_,uint32> value) : uint32 #) + elif typeeq<'T, uint32> then convPrim<_,'U> value elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.u4" (convPrim<_,int64> value) : uint32 #) elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.u4" (convPrim<_,uint64> value) : uint32 #) elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.u4" (convPrim<_,nativeint> value) : uint32 #) @@ -2949,8 +2968,8 @@ namespace Microsoft.FSharp.Core elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.i4" (convPrim<_,byte> value) : int32 #) elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.i4" (convPrim<_,int16> value) : int32 #) elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.i4" (convPrim<_,uint16> value) : int32 #) - elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.i4" (convPrim<_,int32> value) : int32 #) - elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.i4" (convPrim<_,uint32> value) : int32 #) + elif typeeq<'T, int32> then convPrim<_,'U> value + elif typeeq<'T, uint32> then convPrim<_,'U> (# "" (convPrim<_,uint32> value) : int32 #) elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.i4" (convPrim<_,int64> value) : int32 #) elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.i4" (convPrim<_,uint64> value) : int32 #) elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.i4" (convPrim<_,nativeint> value) : int32 #) @@ -2968,7 +2987,7 @@ namespace Microsoft.FSharp.Core elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.i8" (convPrim<_,int32> value) : uint64 #) elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.u8" (convPrim<_,uint32> value) : uint64 #) elif typeeq<'T, int64> then convPrim<_,'U> (# "" (convPrim<_,int64> value) : uint64 #) - elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.i8" (convPrim<_,uint64> value) : uint64 #) + elif typeeq<'T, uint64> then convPrim<_,'U> value elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.i8" (convPrim<_,nativeint> value) : uint64 #) elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.u8" (convPrim<_,unativeint> value) : uint64 #) elif typeeq<'T, float> then convPrim<_,'U> (# "conv.u8" (convPrim<_,float> value) : uint64 #) @@ -2983,12 +3002,12 @@ namespace Microsoft.FSharp.Core elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.u8" (convPrim<_,uint16> value) : int64 #) elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.i8" (convPrim<_,int32> value) : int64 #) elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.u8" (convPrim<_,uint32> value) : int64 #) - elif typeeq<'T, int64> then convPrim<_,'U> (convPrim<_,int64> value) + elif typeeq<'T, int64> then convPrim<_,'U> value elif typeeq<'T, uint64> then convPrim<_,'U> (# "" (convPrim<_,uint64> value) : int64 #) elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.i8" (convPrim<_,nativeint> value) : int64 #) elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.u8" (convPrim<_,unativeint> value) : int64 #) - elif typeeq<'T, float> then convPrim<_,'U> (# "conv.u8" (convPrim<_,float> value) : int64 #) - elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.u8" (convPrim<_,float32> value) : int64 #) + elif typeeq<'T, float> then convPrim<_,'U> (# "conv.i8" (convPrim<_,float> value) : int64 #) + elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.i8" (convPrim<_,float32> value) : int64 #) elif typeeq<'T, char> then convPrim<_,'U> (# "conv.u8" (convPrim<_,char> value) : int64 #) elif typeeq<'T, string> then convPrim<_,'U> (ParseInt64 (convPrim<_,string> value)) else UnaryOpDynamicImplTable.Invoke "op_Explicit" value @@ -3004,6 +3023,7 @@ namespace Microsoft.FSharp.Core elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.r4" (convPrim<_,nativeint> value) : float32 #) elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.r.un conv.r4" (convPrim<_,unativeint> value) : float32 #) elif typeeq<'T, float> then convPrim<_,'U> (# "conv.r4" (convPrim<_,float> value) : float32 #) + // NOTE: float32 should convert its argument to 32-bit float even when applied to a higher precision float stored in a register. See devdiv2#49888. elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.r4" (convPrim<_,float32> value) : float32 #) elif typeeq<'T, char> then convPrim<_,'U> (# "conv.r.un conv.r4" (convPrim<_,char> value) : float32 #) elif typeeq<'T, string> then convPrim<_,'U> (ParseSingle (convPrim<_,string> value)) @@ -3019,6 +3039,7 @@ namespace Microsoft.FSharp.Core elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.r.un conv.r8" (convPrim<_,uint64> value) : float #) elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.r8" (convPrim<_,nativeint> value) : float #) elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.r.un conv.r8" (convPrim<_,unativeint> value) : float #) + // NOTE: float should convert its argument to 64-bit float even when applied to a higher precision float stored in a register. See devdiv2#49888. elif typeeq<'T, float> then convPrim<_,'U> (# "conv.r8" (convPrim<_,float> value) : float #) elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.r8" (convPrim<_,float32> value) : float #) elif typeeq<'T, char> then convPrim<_,'U> (# "conv.r.un conv.r8" (convPrim<_,char> value) : float #) @@ -3035,10 +3056,11 @@ namespace Microsoft.FSharp.Core elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.i" (convPrim<_,int64> value) : unativeint #) elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.u" (convPrim<_,uint64> value) : unativeint #) elif typeeq<'T, nativeint> then convPrim<_,'U> (# "" (convPrim<_,nativeint> value) : unativeint #) - elif typeeq<'T, unativeint> then convPrim<_,'U> (# "" (convPrim<_,unativeint> value) : unativeint #) + elif typeeq<'T, unativeint> then convPrim<_,'U> value elif typeeq<'T, float> then convPrim<_,'U> (# "conv.u" (convPrim<_,float> value) : unativeint #) elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.u" (convPrim<_,float32> value) : unativeint #) elif typeeq<'T, char> then convPrim<_,'U> (# "conv.u" (convPrim<_,char> value) : unativeint #) + elif typeeq<'T, decimal> then convPrim<_,'U> (# "conv.u" (Decimal.op_Explicit (convPrim<_,decimal> value) : uint64) : unativeint #) elif typeeq<'T, string> then convPrim<_,'U> (ParseUIntPtr (convPrim<_,string> value)) else UnaryOpDynamicImplTable.Invoke "op_Explicit" value elif typeeq<'U, nativeint> then @@ -3050,11 +3072,12 @@ namespace Microsoft.FSharp.Core elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.u" (convPrim<_,uint32> value) : nativeint #) elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.i" (convPrim<_,int64> value) : nativeint #) elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.u" (convPrim<_,uint64> value) : nativeint #) - elif typeeq<'T, nativeint> then convPrim<_,'U> (# "" (convPrim<_,nativeint> value) : nativeint #) + elif typeeq<'T, nativeint> then convPrim<_,'U> value elif typeeq<'T, unativeint> then convPrim<_,'U> (# "" (convPrim<_,unativeint> value) : nativeint #) elif typeeq<'T, float> then convPrim<_,'U> (# "conv.i" (convPrim<_,float> value) : nativeint #) elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.i" (convPrim<_,float32> value) : nativeint #) elif typeeq<'T, char> then convPrim<_,'U> (# "conv.u" (convPrim<_,char> value) : nativeint #) + elif typeeq<'T, decimal> then convPrim<_,'U> (# "conv.i" (Decimal.op_Explicit (convPrim<_,decimal> value) : int64) : nativeint #) elif typeeq<'T, string> then convPrim<_,'U> (ParseIntPtr (convPrim<_,string> value)) else UnaryOpDynamicImplTable.Invoke "op_Explicit" value elif typeeq<'U, char> then @@ -3070,7 +3093,8 @@ namespace Microsoft.FSharp.Core elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.u2" (convPrim<_,unativeint> value) : char #) elif typeeq<'T, float> then convPrim<_,'U> (# "conv.u2" (convPrim<_,float> value) : char #) elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.u2" (convPrim<_,float32> value) : char #) - elif typeeq<'T, char> then convPrim<_,'U> (# "conv.u2" (convPrim<_,char> value) : char #) + elif typeeq<'T, char> then convPrim<_,'U> value + elif typeeq<'T, decimal> then convPrim<_,'U> (Decimal.op_Explicit (convPrim<_,decimal> value) : char) elif typeeq<'T, string> then convPrim<_,'U> (Char.Parse (convPrim<_,string> value)) else UnaryOpDynamicImplTable.Invoke "op_Explicit" value elif typeeq<'U, decimal> then @@ -3086,7 +3110,240 @@ namespace Microsoft.FSharp.Core elif typeeq<'T, unativeint> then convPrim<_,'U> (Convert.ToDecimal (# "conv.u8" (convPrim<_,unativeint> value) : uint64 #)) elif typeeq<'T, float> then convPrim<_,'U> (Convert.ToDecimal (convPrim<_,float> value)) elif typeeq<'T, float32> then convPrim<_,'U> (Convert.ToDecimal (convPrim<_,float32> value)) - elif typeeq<'T, char> then convPrim<_,'U> (Convert.ToDecimal (convPrim<_,char> value)) + elif typeeq<'T, char> then convPrim<_,'U> (Convert.ToDecimal (# "" (convPrim<_,char> value) : uint16 #)) + elif typeeq<'T, decimal> then convPrim<_,'U> value + elif typeeq<'T, string> then convPrim<_,'U> (Decimal.Parse(convPrim<_,string> value, NumberStyles.Float,CultureInfo.InvariantCulture)) + else UnaryOpDynamicImplTable.Invoke "op_Explicit" value + else + UnaryOpDynamicImplTable.Invoke "op_Explicit" value + + let CheckedExplicitDynamic<'T, 'U> (value: 'T) : 'U = + if typeeq<'U, byte> then + if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.ovf.u1" (convPrim<_,sbyte> value) : byte #) + elif typeeq<'T, byte> then convPrim<_,'U> value + elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.ovf.u1" (convPrim<_,int16> value) : byte #) + elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.ovf.u1.un" (convPrim<_,uint16> value) : byte #) + elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.ovf.u1" (convPrim<_,int32> value) : byte #) + elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.ovf.u1.un" (convPrim<_,uint32> value) : byte #) + elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.ovf.u1" (convPrim<_,int64> value) : byte #) + elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.ovf.u1.un" (convPrim<_,uint64> value) : byte #) + elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.ovf.u1" (convPrim<_,nativeint> value) : byte #) + elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.ovf.u1.un" (convPrim<_,unativeint> value) : byte #) + elif typeeq<'T, float> then convPrim<_,'U> (# "conv.ovf.u1" (convPrim<_,float> value) : byte #) + elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.ovf.u1" (convPrim<_,float32> value) : byte #) + elif typeeq<'T, char> then convPrim<_,'U> (# "conv.ovf.u1.un" (convPrim<_,char> value) : byte #) + elif typeeq<'T, string> then convPrim<_,'U> (ParseByte (convPrim<_,string> value)) + else UnaryOpDynamicImplTable.Invoke "op_Explicit" value + elif typeeq<'U, sbyte> then + if typeeq<'T, sbyte> then convPrim<_,'U> value + elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.ovf.i1.un" (convPrim<_,byte> value) : sbyte #) + elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.ovf.i1" (convPrim<_,int16> value) : sbyte #) + elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.ovf.i1.un" (convPrim<_,uint16> value) : sbyte #) + elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.ovf.i1" (convPrim<_,int32> value) : sbyte #) + elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.ovf.i1.un" (convPrim<_,uint32> value) : sbyte #) + elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.ovf.i1" (convPrim<_,int64> value) : sbyte #) + elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.ovf.i1.un" (convPrim<_,uint64> value) : sbyte #) + elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.ovf.i1" (convPrim<_,nativeint> value) : sbyte #) + elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.ovf.i1.un" (convPrim<_,unativeint> value) : sbyte #) + elif typeeq<'T, float> then convPrim<_,'U> (# "conv.ovf.i1" (convPrim<_,float> value) : sbyte #) + elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.ovf.i1" (convPrim<_,float32> value) : sbyte #) + elif typeeq<'T, char> then convPrim<_,'U> (# "conv.ovf.i1.un" (convPrim<_,char> value) : sbyte #) + elif typeeq<'T, string> then convPrim<_,'U> (ParseSByte (convPrim<_,string> value)) + else UnaryOpDynamicImplTable.Invoke "op_Explicit" value + elif typeeq<'U, uint16> then + if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.ovf.u2" (convPrim<_,sbyte> value) : uint16 #) + elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.ovf.u2.un" (convPrim<_,byte> value) : uint16 #) + elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.ovf.u2" (convPrim<_,int16> value) : uint16 #) + elif typeeq<'T, uint16> then convPrim<_,'U> value + elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.ovf.u2" (convPrim<_,int32> value) : uint16 #) + elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.ovf.u2.un" (convPrim<_,uint32> value) : uint16 #) + elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.ovf.u2" (convPrim<_,int64> value) : uint16 #) + elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.ovf.u2.un" (convPrim<_,uint64> value) : uint16 #) + elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.ovf.u2" (convPrim<_,nativeint> value) : uint16 #) + elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.ovf.u2.un" (convPrim<_,unativeint> value) : uint16 #) + elif typeeq<'T, float> then convPrim<_,'U> (# "conv.ovf.u2" (convPrim<_,float> value) : uint16 #) + elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.ovf.u2" (convPrim<_,float32> value) : uint16 #) + elif typeeq<'T, char> then convPrim<_,'U> (# "" (convPrim<_,char> value) : uint16 #) + elif typeeq<'T, string> then convPrim<_,'U> (ParseUInt16 (convPrim<_,string> value)) + else UnaryOpDynamicImplTable.Invoke "op_Explicit" value + elif typeeq<'U, int16> then + if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.ovf.i2" (convPrim<_,sbyte> value) : int16 #) + elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.ovf.i2.un" (convPrim<_,byte> value) : int16 #) + elif typeeq<'T, int16> then convPrim<_,'U> value + elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.ovf.i2.un" (convPrim<_,uint16> value) : int16 #) + elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.ovf.i2" (convPrim<_,int32> value) : int16 #) + elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.ovf.i2.un" (convPrim<_,uint32> value) : int16 #) + elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.ovf.i2" (convPrim<_,int64> value) : int16 #) + elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.ovf.i2.un" (convPrim<_,uint64> value) : int16 #) + elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.ovf.i2" (convPrim<_,nativeint> value) : int16 #) + elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.ovf.i2.un" (convPrim<_,unativeint> value) : int16 #) + elif typeeq<'T, float> then convPrim<_,'U> (# "conv.ovf.i2" (convPrim<_,float> value) : int16 #) + elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.ovf.i2" (convPrim<_,float32> value) : int16 #) + elif typeeq<'T, char> then convPrim<_,'U> (# "conv.ovf.i2.un" (convPrim<_,char> value) : int16 #) + elif typeeq<'T, string> then convPrim<_,'U> (ParseInt16 (convPrim<_,string> value)) + else UnaryOpDynamicImplTable.Invoke "op_Explicit" value + elif typeeq<'U, uint32> then + if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.ovf.u4" (convPrim<_,sbyte> value) : uint32 #) + elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.ovf.u4.un" (convPrim<_,byte> value) : uint32 #) + elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.ovf.u4" (convPrim<_,int16> value) : uint32 #) + elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.ovf.u4.un" (convPrim<_,uint16> value) : uint32 #) + elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.ovf.u4" (convPrim<_,int32> value) : uint32 #) + elif typeeq<'T, uint32> then convPrim<_,'U> value + elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.ovf.u4" (convPrim<_,int64> value) : uint32 #) + elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.ovf.u4.un" (convPrim<_,uint64> value) : uint32 #) + elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.ovf.u4" (convPrim<_,nativeint> value) : uint32 #) + elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.ovf.u4.un" (convPrim<_,unativeint> value) : uint32 #) + elif typeeq<'T, float> then convPrim<_,'U> (# "conv.ovf.u4" (convPrim<_,float> value) : uint32 #) + elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.ovf.u4" (convPrim<_,float32> value) : uint32 #) + elif typeeq<'T, char> then convPrim<_,'U> (# "conv.ovf.u4.un" (convPrim<_,char> value) : uint32 #) + elif typeeq<'T, string> then convPrim<_,'U> (ParseUInt32 (convPrim<_,string> value)) + else UnaryOpDynamicImplTable.Invoke "op_Explicit" value + elif typeeq<'U, int32> then + if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.ovf.i4" (convPrim<_,sbyte> value) : int32 #) + elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.ovf.i4.un" (convPrim<_,byte> value) : int32 #) + elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.ovf.i4" (convPrim<_,int16> value) : int32 #) + elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.ovf.i4.un" (convPrim<_,uint16> value) : int32 #) + elif typeeq<'T, int32> then convPrim<_,'U> value + elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.ovf.i4.un" (convPrim<_,uint32> value) : int32 #) + elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.ovf.i4" (convPrim<_,int64> value) : int32 #) + elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.ovf.i4.un" (convPrim<_,uint64> value) : int32 #) + elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.ovf.i4" (convPrim<_,nativeint> value) : int32 #) + elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.ovf.i4.un" (convPrim<_,unativeint> value) : int32 #) + elif typeeq<'T, float> then convPrim<_,'U> (# "conv.ovf.i4" (convPrim<_,float> value) : int32 #) + elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.ovf.i4" (convPrim<_,float32> value) : int32 #) + elif typeeq<'T, char> then convPrim<_,'U> (# "conv.ovf.i4.un" (convPrim<_,char> value) : int32 #) + elif typeeq<'T, string> then convPrim<_,'U> (ParseInt32 (convPrim<_,string> value)) + else UnaryOpDynamicImplTable.Invoke "op_Explicit" value + elif typeeq<'U, uint64> then + if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.ovf.u8" (convPrim<_,sbyte> value) : uint64 #) + elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.ovf.u8.un" (convPrim<_,byte> value) : uint64 #) + elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.ovf.u8" (convPrim<_,int16> value) : uint64 #) + elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.ovf.u8.un" (convPrim<_,uint16> value) : uint64 #) + elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.ovf.u8" (convPrim<_,int32> value) : uint64 #) + elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.ovf.u8.un" (convPrim<_,uint32> value) : uint64 #) + elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.ovf.u8" (convPrim<_,int64> value) : uint64 #) + elif typeeq<'T, uint64> then convPrim<_,'U> value + elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.ovf.u8" (convPrim<_,nativeint> value) : uint64 #) + elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.ovf.u8.un" (convPrim<_,unativeint> value) : uint64 #) + elif typeeq<'T, float> then convPrim<_,'U> (# "conv.ovf.u8" (convPrim<_,float> value) : uint64 #) + elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.ovf.u8" (convPrim<_,float32> value) : uint64 #) + elif typeeq<'T, char> then convPrim<_,'U> (# "conv.ovf.u8.un" (convPrim<_,char> value) : uint64 #) + elif typeeq<'T, string> then convPrim<_,'U> (ParseUInt64 (convPrim<_,string> value)) + else UnaryOpDynamicImplTable.Invoke "op_Explicit" value + elif typeeq<'U, int64> then + if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.ovf.i8" (convPrim<_,sbyte> value) : int64 #) + elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.ovf.i8.un" (convPrim<_,byte> value) : int64 #) + elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.ovf.i8" (convPrim<_,int16> value) : int64 #) + elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.ovf.i8.un" (convPrim<_,uint16> value) : int64 #) + elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.ovf.i8" (convPrim<_,int32> value) : int64 #) + elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.ovf.i8.un" (convPrim<_,uint32> value) : int64 #) + elif typeeq<'T, int64> then convPrim<_,'U> value + elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.ovf.i8.un" (convPrim<_,uint64> value) : int64 #) + elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.ovf.i8" (convPrim<_,nativeint> value) : int64 #) + elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.ovf.i8.un" (convPrim<_,unativeint> value) : int64 #) + elif typeeq<'T, float> then convPrim<_,'U> (# "conv.ovf.i8" (convPrim<_,float> value) : int64 #) + elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.ovf.i8" (convPrim<_,float32> value) : int64 #) + elif typeeq<'T, char> then convPrim<_,'U> (# "conv.ovf.i8.un" (convPrim<_,char> value) : int64 #) + elif typeeq<'T, string> then convPrim<_,'U> (ParseInt64 (convPrim<_,string> value)) + else UnaryOpDynamicImplTable.Invoke "op_Explicit" value + elif typeeq<'U, float32> then + if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.r4" (convPrim<_,sbyte> value) : float32 #) + elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.r.un conv.r4" (convPrim<_,byte> value) : float32 #) + elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.r4" (convPrim<_,int16> value) : float32 #) + elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.r.un conv.r4" (convPrim<_,uint16> value) : float32 #) + elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.r4" (convPrim<_,int32> value) : float32 #) + elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.r.un conv.r4" (convPrim<_,uint32> value) : float32 #) + elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.r4" (convPrim<_,int64> value) : float32 #) + elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.r.un conv.r4" (convPrim<_,uint64> value) : float32 #) + elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.r4" (convPrim<_,nativeint> value) : float32 #) + elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.r.un conv.r4" (convPrim<_,unativeint> value) : float32 #) + elif typeeq<'T, float> then convPrim<_,'U> (# "conv.r4" (convPrim<_,float> value) : float32 #) + elif typeeq<'T, float32> then convPrim<_,'U> value + elif typeeq<'T, char> then convPrim<_,'U> (# "conv.r.un conv.r4" (convPrim<_,char> value) : float32 #) + elif typeeq<'T, string> then convPrim<_,'U> (ParseSingle (convPrim<_,string> value)) + else UnaryOpDynamicImplTable.Invoke "op_Explicit" value + elif typeeq<'U, float> then + if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.r8" (convPrim<_,sbyte> value) : float #) + elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.r.un conv.r8" (convPrim<_,byte> value) : float #) + elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.r8" (convPrim<_,int16> value) : float #) + elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.r.un conv.r8" (convPrim<_,uint16> value) : float #) + elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.r8" (convPrim<_,int32> value) : float #) + elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.r.un conv.r8" (convPrim<_,uint32> value) : float #) + elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.r8" (convPrim<_,int64> value) : float #) + elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.r.un conv.r8" (convPrim<_,uint64> value) : float #) + elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.r8" (convPrim<_,nativeint> value) : float #) + elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.r.un conv.r8" (convPrim<_,unativeint> value) : float #) + elif typeeq<'T, float> then convPrim<_,'U> value + elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.r8" (convPrim<_,float32> value) : float #) + elif typeeq<'T, char> then convPrim<_,'U> (# "conv.r.un conv.r8" (convPrim<_,char> value) : float #) + elif typeeq<'T, decimal> then convPrim<_,'U> (Convert.ToDouble(convPrim<_,decimal> value)) + elif typeeq<'T, string> then convPrim<_,'U> (ParseDouble (convPrim<_,string> value)) + else UnaryOpDynamicImplTable.Invoke "op_Explicit" value + elif typeeq<'U, unativeint> then + if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.ovf.u" (convPrim<_,sbyte> value) : unativeint #) + elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.ovf.u.un" (convPrim<_,byte> value) : unativeint #) + elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.ovf.u" (convPrim<_,int16> value) : unativeint #) + elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.ovf.u.un" (convPrim<_,uint16> value) : unativeint #) + elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.ovf.u" (convPrim<_,int32> value) : unativeint #) + elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.ovf.u.un" (convPrim<_,uint32> value) : unativeint #) + elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.ovf.u" (convPrim<_,int64> value) : unativeint #) + elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.ovf.u.un" (convPrim<_,uint64> value) : unativeint #) + elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.ovf.u" (convPrim<_,nativeint> value) : unativeint #) + elif typeeq<'T, unativeint> then convPrim<_,'U> value + elif typeeq<'T, float> then convPrim<_,'U> (# "conv.ovf.u" (convPrim<_,float> value) : unativeint #) + elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.ovf.u" (convPrim<_,float32> value) : unativeint #) + elif typeeq<'T, char> then convPrim<_,'U> (# "conv.ovf.u.un" (convPrim<_,char> value) : unativeint #) + elif typeeq<'T, decimal> then convPrim<_,'U> (# "conv.ovf.u" (Decimal.op_Explicit (convPrim<_,decimal> value) : uint64) : unativeint #) + elif typeeq<'T, string> then convPrim<_,'U> (ParseUIntPtr (convPrim<_,string> value)) + else UnaryOpDynamicImplTable.Invoke "op_Explicit" value + elif typeeq<'U, nativeint> then + if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.ovf.i" (convPrim<_,sbyte> value) : nativeint #) + elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.ovf.i.un" (convPrim<_,byte> value) : nativeint #) + elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.ovf.i" (convPrim<_,int16> value) : nativeint #) + elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.ovf.i.un" (convPrim<_,uint16> value) : nativeint #) + elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.ovf.i" (convPrim<_,int32> value) : nativeint #) + elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.ovf.i.un" (convPrim<_,uint32> value) : nativeint #) + elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.ovf.i" (convPrim<_,int64> value) : nativeint #) + elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.ovf.i.un" (convPrim<_,uint64> value) : nativeint #) + elif typeeq<'T, nativeint> then convPrim<_,'U> value + elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.ovf.i.un" (convPrim<_,unativeint> value) : nativeint #) + elif typeeq<'T, float> then convPrim<_,'U> (# "conv.ovf.i" (convPrim<_,float> value) : nativeint #) + elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.ovf.i" (convPrim<_,float32> value) : nativeint #) + elif typeeq<'T, char> then convPrim<_,'U> (# "conv.ovf.i.un" (convPrim<_,char> value) : nativeint #) + elif typeeq<'T, decimal> then convPrim<_,'U> (# "conv.ovf.i" (Decimal.op_Explicit (convPrim<_,decimal> value) : int64) : nativeint #) + elif typeeq<'T, string> then convPrim<_,'U> (ParseIntPtr (convPrim<_,string> value)) + else UnaryOpDynamicImplTable.Invoke "op_Explicit" value + elif typeeq<'U, char> then + if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.ovf.u2" (convPrim<_,sbyte> value) : char #) + elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.ovf.u2.un" (convPrim<_,byte> value) : char #) + elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.ovf.u2" (convPrim<_,int16> value) : char #) + elif typeeq<'T, uint16> then convPrim<_,'U> (# "" (convPrim<_,uint16> value) : char #) + elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.ovf.u2" (convPrim<_,int32> value) : char #) + elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.ovf.u2.un" (convPrim<_,uint32> value) : char #) + elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.ovf.u2" (convPrim<_,int64> value) : char #) + elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.ovf.u2.un" (convPrim<_,uint64> value) : char #) + elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.ovf.u2" (convPrim<_,nativeint> value) : char #) + elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.ovf.u2.un" (convPrim<_,unativeint> value) : char #) + elif typeeq<'T, float> then convPrim<_,'U> (# "conv.ovf.u2" (convPrim<_,float> value) : char #) + elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.ovf.u2" (convPrim<_,float32> value) : char #) + elif typeeq<'T, char> then convPrim<_,'U> value + elif typeeq<'T, decimal> then convPrim<_,'U> (Decimal.op_Explicit (convPrim<_,decimal> value) : char) + elif typeeq<'T, string> then convPrim<_,'U> (System.Char.Parse (convPrim<_,string> value)) + else UnaryOpDynamicImplTable.Invoke "op_Explicit" value + elif typeeq<'U, decimal> then + if typeeq<'T, sbyte> then convPrim<_,'U> (Convert.ToDecimal (convPrim<_,sbyte> value)) + elif typeeq<'T, byte> then convPrim<_,'U> (Convert.ToDecimal (convPrim<_,byte> value)) + elif typeeq<'T, int16> then convPrim<_,'U> (Convert.ToDecimal (convPrim<_,int16> value)) + elif typeeq<'T, uint16> then convPrim<_,'U> (Convert.ToDecimal (convPrim<_,uint16> value)) + elif typeeq<'T, int32> then convPrim<_,'U> (Convert.ToDecimal (convPrim<_,int32> value)) + elif typeeq<'T, uint32> then convPrim<_,'U> (Convert.ToDecimal (convPrim<_,uint32> value)) + elif typeeq<'T, int64> then convPrim<_,'U> (Convert.ToDecimal (convPrim<_,int64> value)) + elif typeeq<'T, uint64> then convPrim<_,'U> (Convert.ToDecimal (convPrim<_,uint64> value)) + elif typeeq<'T, nativeint> then convPrim<_,'U> (Convert.ToDecimal (# "conv.i8" (convPrim<_,nativeint> value) : int64 #)) + elif typeeq<'T, unativeint> then convPrim<_,'U> (Convert.ToDecimal (# "conv.u8" (convPrim<_,unativeint> value) : uint64 #)) + elif typeeq<'T, float> then convPrim<_,'U> (Convert.ToDecimal (convPrim<_,float> value)) + elif typeeq<'T, float32> then convPrim<_,'U> (Convert.ToDecimal (convPrim<_,float32> value)) + elif typeeq<'T, char> then convPrim<_,'U> (Convert.ToDecimal (# "" (convPrim<_,char> value) : uint16 #)) elif typeeq<'T, decimal> then convPrim<'T,'U> value elif typeeq<'T, string> then convPrim<_,'U> (Decimal.Parse(convPrim<_,string> value, NumberStyles.Float,CultureInfo.InvariantCulture)) else UnaryOpDynamicImplTable.Invoke "op_Explicit" value @@ -3211,7 +3468,7 @@ namespace Microsoft.FSharp.Core elif type2eq<'T1, 'T2, char> && typeeq<'U, bool> then convPrim<_,'U> (not (# "ceq" (convPrim<_,char> x) (convPrim<_,char> y) : bool #)) elif type2eq<'T1, 'T2, decimal> && typeeq<'U, bool> then convPrim<_,'U> (Decimal.op_Inequality (convPrim<_,decimal> x, convPrim<_,decimal> y)) elif type2eq<'T1, 'T2, string> && typeeq<'U, bool> then convPrim<_,'U> (not (String.Equals (convPrim<_,string> x, convPrim<_,string> y))) - else BinaryOpDynamicImplTable.Invoke "op_Inequality" x y + else BinaryOpDynamicImplTable.Invoke "op_Inequality" x y type DivideByIntInfo = class end @@ -4054,6 +4311,7 @@ namespace Microsoft.FSharp.Core when ^T : unativeint and ^U : unativeint = (# "sub" x y : unativeint #) when ^T : int16 and ^U : int16 = (# "conv.i2" (# "sub" x y : int32 #) : int16 #) when ^T : uint16 and ^U : uint16 = (# "conv.u2" (# "sub" x y : uint32 #) : uint16 #) + when ^T : char and ^U : char = (# "conv.u2" (# "sub" x y : uint32 #) : char #) when ^T : sbyte and ^U : sbyte = (# "conv.i1" (# "sub" x y : int32 #) : sbyte #) when ^T : byte and ^U : byte = (# "conv.u1" (# "sub" x y : uint32 #) : byte #) when ^T : decimal and ^U : decimal = (# "" (Decimal.op_Subtraction((# "" x : decimal #),(# "" y : decimal #))) : ^V #) @@ -4283,7 +4541,7 @@ namespace Microsoft.FSharp.Core when ^T : uint16 = (# "conv.u1" value : byte #) when ^T : char = (# "conv.u1" value : byte #) when ^T : unativeint = (# "conv.u1" value : byte #) - when ^T : byte = (# "conv.u1" value : byte #) + when ^T : byte = (# "" value : byte #) // According to the somewhat subtle rules of static optimizations, // this condition is used whenever ^T is resolved to a nominal type or witnesses are available when ^T : ^T = (^T : (static member op_Explicit: ^T -> byte) (value)) @@ -4299,11 +4557,11 @@ namespace Microsoft.FSharp.Core when ^T : int32 = (# "conv.i1" value : sbyte #) when ^T : int16 = (# "conv.i1" value : sbyte #) when ^T : nativeint = (# "conv.i1" value : sbyte #) - when ^T : sbyte = (# "conv.i1" value : sbyte #) - when ^T : uint64 = (# "conv.i1" value : sbyte #) - when ^T : uint32 = (# "conv.i1" value : sbyte #) - when ^T : uint16 = (# "conv.i1" value : sbyte #) - when ^T : char = (# "conv.i1" value : sbyte #) + when ^T : sbyte = (# "" value : sbyte #) + when ^T : uint64 = (# "conv.i1" value : sbyte #) + when ^T : uint32 = (# "conv.i1" value : sbyte #) + when ^T : uint16 = (# "conv.i1" value : sbyte #) + when ^T : char = (# "conv.i1" value : sbyte #) when ^T : unativeint = (# "conv.i1" value : sbyte #) when ^T : byte = (# "conv.i1" value : sbyte #) // According to the somewhat subtle rules of static optimizations, @@ -4322,10 +4580,10 @@ namespace Microsoft.FSharp.Core when ^T : int16 = (# "conv.u2" value : uint16 #) when ^T : nativeint = (# "conv.u2" value : uint16 #) when ^T : sbyte = (# "conv.u2" value : uint16 #) - when ^T : uint64 = (# "conv.u2" value : uint16 #) - when ^T : uint32 = (# "conv.u2" value : uint16 #) - when ^T : uint16 = (# "conv.u2" value : uint16 #) - when ^T : char = (# "conv.u2" value : uint16 #) + when ^T : uint64 = (# "conv.u2" value : uint16 #) + when ^T : uint32 = (# "conv.u2" value : uint16 #) + when ^T : uint16 = (# "" value : uint16 #) + when ^T : char = (# "" value : uint16 #) when ^T : unativeint = (# "conv.u2" value : uint16 #) when ^T : byte = (# "conv.u2" value : uint16 #) // According to the somewhat subtle rules of static optimizations, @@ -4341,7 +4599,7 @@ namespace Microsoft.FSharp.Core when ^T : float32 = (# "conv.i2" value : int16 #) when ^T : int64 = (# "conv.i2" value : int16 #) when ^T : int32 = (# "conv.i2" value : int16 #) - when ^T : int16 = (# "conv.i2" value : int16 #) + when ^T : int16 = (# "" value : int16 #) when ^T : nativeint = (# "conv.i2" value : int16 #) when ^T : sbyte = (# "conv.i2" value : int16 #) when ^T : uint64 = (# "conv.i2" value : int16 #) @@ -4368,10 +4626,10 @@ namespace Microsoft.FSharp.Core when ^T : int32 = (# "" value : uint32 #) when ^T : int16 = (# "" value : uint32 #) when ^T : sbyte = (# "" value : uint32 #) - when ^T : uint64 = (# "conv.u4" value : uint32 #) - when ^T : uint32 = (# "conv.u4" value : uint32 #) - when ^T : uint16 = (# "conv.u4" value : uint32 #) - when ^T : char = (# "conv.u4" value : uint32 #) + when ^T : uint64 = (# "conv.u4" value : uint32 #) + when ^T : uint32 = (# "" value : uint32 #) + when ^T : uint16 = (# "conv.u4" value : uint32 #) + when ^T : char = (# "conv.u4" value : uint32 #) when ^T : unativeint = (# "conv.u4" value : uint32 #) when ^T : byte = (# "conv.u4" value : uint32 #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> uint32) (value)) @@ -4453,7 +4711,7 @@ namespace Microsoft.FSharp.Core when ^T : string = ParseInt64 (castToString value) when ^T : float = (# "conv.i8" value : int64 #) when ^T : float32 = (# "conv.i8" value : int64 #) - when ^T : int64 = (# "conv.i8" value : int64 #) + when ^T : int64 = (# "" value : int64 #) when ^T : int32 = (# "conv.i8" value : int64 #) when ^T : int16 = (# "conv.i8" value : int64 #) when ^T : nativeint = (# "conv.i8" value : int64 #) @@ -4517,18 +4775,19 @@ namespace Microsoft.FSharp.Core let inline decimal (value: ^T) = ExplicitDynamic<(^T), decimal> value when ^T : string = (Decimal.Parse(castToString value,NumberStyles.Float,CultureInfo.InvariantCulture)) - when ^T : float = (Convert.ToDecimal((# "" value : float #))) - when ^T : float32 = (Convert.ToDecimal((# "" value : float32 #))) - when ^T : int64 = (Convert.ToDecimal((# "" value : int64 #))) - when ^T : int32 = (Convert.ToDecimal((# "" value : int32 #))) - when ^T : int16 = (Convert.ToDecimal((# "" value : int16 #))) - when ^T : nativeint = (Convert.ToDecimal(int64 (# "" value : nativeint #))) - when ^T : sbyte = (Convert.ToDecimal((# "" value : sbyte #))) - when ^T : uint64 = (Convert.ToDecimal((# "" value : uint64 #))) - when ^T : uint32 = (Convert.ToDecimal((# "" value : uint32 #))) - when ^T : uint16 = (Convert.ToDecimal((# "" value : uint16 #))) - when ^T : unativeint = (Convert.ToDecimal(uint64 (# "" value : unativeint #))) - when ^T : byte = (Convert.ToDecimal((# "" value : byte #))) + when ^T : float = (Convert.ToDecimal((# "" value : float #))) + when ^T : float32 = (Convert.ToDecimal((# "" value : float32 #))) + when ^T : int64 = (Convert.ToDecimal((# "" value : int64 #))) + when ^T : int32 = (Convert.ToDecimal((# "" value : int32 #))) + when ^T : int16 = (Convert.ToDecimal((# "" value : int16 #))) + when ^T : nativeint = (Convert.ToDecimal(int64 (# "" value : nativeint #))) + when ^T : sbyte = (Convert.ToDecimal((# "" value : sbyte #))) + when ^T : uint64 = (Convert.ToDecimal((# "" value : uint64 #))) + when ^T : uint32 = (Convert.ToDecimal((# "" value : uint32 #))) + when ^T : uint16 = (Convert.ToDecimal((# "" value : uint16 #))) + when ^T : unativeint = (Convert.ToDecimal(uint64 (# "" value : unativeint #))) + when ^T : byte = (Convert.ToDecimal((# "" value : byte #))) + when ^T : char = (Convert.ToDecimal((# "" value : uint16 #))) // Don't use the char overload which unconditionally raises an exception when ^T : decimal = (# "" value : decimal #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> decimal) (value)) @@ -4553,7 +4812,8 @@ namespace Microsoft.FSharp.Core when ^T : uint16 = (# "conv.u" value : unativeint #) when ^T : char = (# "conv.u" value : unativeint #) when ^T : unativeint = (# "" value : unativeint #) - when ^T : byte = (# "conv.u" value : unativeint #) + when ^T : byte = (# "conv.u" value : unativeint #) + when ^T : decimal = (# "conv.u" (uint64 (# "" value : decimal #)) : unativeint #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> unativeint) (value)) [] @@ -4566,7 +4826,7 @@ namespace Microsoft.FSharp.Core when ^T : int64 = (# "conv.i" value : nativeint #) when ^T : int32 = (# "conv.i" value : nativeint #) when ^T : int16 = (# "conv.i" value : nativeint #) - when ^T : nativeint = (# "conv.i" value : nativeint #) + when ^T : nativeint = (# "" value : nativeint #) when ^T : sbyte = (# "conv.i" value : nativeint #) // Narrower unsigned types we zero-extend. // Same length unsigned types we leave as such (so unsigned MaxValue (all-bits-set) gets reinterpreted as -1). @@ -4578,6 +4838,7 @@ namespace Microsoft.FSharp.Core when ^T : char = (# "conv.u" value : nativeint #) when ^T : unativeint = (# "" value : nativeint #) when ^T : byte = (# "conv.i" value : nativeint #) + when ^T : decimal = (# "conv.i" (int64 (# "" value : decimal #)) : unativeint #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> nativeint) (value)) [] @@ -4651,8 +4912,8 @@ namespace Microsoft.FSharp.Core when ^T : sbyte = (# "conv.u2" value : char #) when ^T : uint64 = (# "conv.u2" value : char #) when ^T : uint32 = (# "conv.u2" value : char #) - when ^T : uint16 = (# "conv.u2" value : char #) - when ^T : char = (# "conv.u2" value : char #) + when ^T : uint16 = (# "" value : char #) + when ^T : char = (# "" value : char #) when ^T : unativeint = (# "conv.u2" value : char #) when ^T : byte = (# "conv.u2" value : char #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> char) (value)) @@ -4980,11 +5241,12 @@ namespace Microsoft.FSharp.Core when ^T : uint32 and ^U : uint32 = (# "sub.ovf.un" x y : uint32 #) when ^T : nativeint and ^U : nativeint = (# "sub.ovf" x y : nativeint #) when ^T : unativeint and ^U : unativeint = (# "sub.ovf.un" x y : unativeint #) - when ^T : int16 and ^U : int16 = (# "conv.ovf.i2" (# "sub.ovf" x y : int32 #) : int16 #) - when ^T : uint16 and ^U : uint16 = (# "conv.ovf.u2.un" (# "sub.ovf.un" x y : uint32 #) : uint16 #) - when ^T : sbyte and ^U : sbyte = (# "conv.ovf.i1" (# "sub.ovf" x y : int32 #) : sbyte #) - when ^T : byte and ^U : byte = (# "conv.ovf.u1.un" (# "sub.ovf.un" x y : uint32 #) : byte #) - when ^T : decimal and ^U : decimal = (# "" (Decimal.op_Subtraction((# "" x : decimal #),(# "" y : decimal #))) : ^V #) + when ^T : int16 and ^U : int16 = (# "conv.ovf.i2" (# "sub.ovf" x y : int32 #) : int16 #) + when ^T : uint16 and ^U : uint16 = (# "conv.ovf.u2.un" (# "sub.ovf.un" x y : uint32 #) : uint16 #) + when ^T : char and ^U : char = (# "conv.ovf.u2.un" (# "sub.ovf.un" x y : uint32 #) : char #) + when ^T : sbyte and ^U : sbyte = (# "conv.ovf.i1" (# "sub.ovf" x y : int32 #) : sbyte #) + when ^T : byte and ^U : byte = (# "conv.ovf.u1.un" (# "sub.ovf.un" x y : uint32 #) : byte #) + when ^T : decimal and ^U : decimal = (# "" (Decimal.op_Subtraction((# "" x : decimal #),(# "" y : decimal #))) : ^V #) when ^T : ^T = ((^T or ^U): (static member (-) : ^T * ^U -> ^V) (x,y)) [] @@ -5023,47 +5285,47 @@ namespace Microsoft.FSharp.Core [] [] let inline byte (value: ^T) = - ExplicitDynamic<(^T),byte> value - when ^T : string = ParseByte (castToString value) - when ^T : float = (# "conv.ovf.u1" value : byte #) - when ^T : float32 = (# "conv.ovf.u1" value : byte #) - when ^T : int64 = (# "conv.ovf.u1" value : byte #) - when ^T : int32 = (# "conv.ovf.u1" value : byte #) - when ^T : int16 = (# "conv.ovf.u1" value : byte #) - when ^T : nativeint = (# "conv.ovf.u1" value : byte #) - when ^T : sbyte = (# "conv.ovf.u1" value : byte #) - when ^T : uint64 = (# "conv.ovf.u1.un" value : byte #) - when ^T : uint32 = (# "conv.ovf.u1.un" value : byte #) - when ^T : uint16 = (# "conv.ovf.u1.un" value : byte #) - when ^T : char = (# "conv.ovf.u1.un" value : byte #) + CheckedExplicitDynamic<(^T),byte> value + when ^T : string = ParseByte (castToString value) + when ^T : float = (# "conv.ovf.u1" value : byte #) + when ^T : float32 = (# "conv.ovf.u1" value : byte #) + when ^T : int64 = (# "conv.ovf.u1" value : byte #) + when ^T : int32 = (# "conv.ovf.u1" value : byte #) + when ^T : int16 = (# "conv.ovf.u1" value : byte #) + when ^T : nativeint = (# "conv.ovf.u1" value : byte #) + when ^T : sbyte = (# "conv.ovf.u1" value : byte #) + when ^T : uint64 = (# "conv.ovf.u1.un" value : byte #) + when ^T : uint32 = (# "conv.ovf.u1.un" value : byte #) + when ^T : uint16 = (# "conv.ovf.u1.un" value : byte #) + when ^T : char = (# "conv.ovf.u1.un" value : byte #) when ^T : unativeint = (# "conv.ovf.u1.un" value : byte #) - when ^T : byte = (# "conv.ovf.u1.un" value : byte #) + when ^T : byte = (# "" value : byte #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> byte) (value)) [] [] let inline sbyte (value: ^T) = - ExplicitDynamic<(^T),sbyte> value - when ^T : string = ParseSByte (castToString value) - when ^T : float = (# "conv.ovf.i1" value : sbyte #) - when ^T : float32 = (# "conv.ovf.i1" value : sbyte #) - when ^T : int64 = (# "conv.ovf.i1" value : sbyte #) - when ^T : int32 = (# "conv.ovf.i1" value : sbyte #) - when ^T : int16 = (# "conv.ovf.i1" value : sbyte #) - when ^T : nativeint = (# "conv.ovf.i1" value : sbyte #) - when ^T : sbyte = (# "conv.ovf.i1" value : sbyte #) - when ^T : uint64 = (# "conv.ovf.i1.un" value : sbyte #) - when ^T : uint32 = (# "conv.ovf.i1.un" value : sbyte #) - when ^T : uint16 = (# "conv.ovf.i1.un" value : sbyte #) - when ^T : char = (# "conv.ovf.i1.un" value : sbyte #) + CheckedExplicitDynamic<(^T),sbyte> value + when ^T : string = ParseSByte (castToString value) + when ^T : float = (# "conv.ovf.i1" value : sbyte #) + when ^T : float32 = (# "conv.ovf.i1" value : sbyte #) + when ^T : int64 = (# "conv.ovf.i1" value : sbyte #) + when ^T : int32 = (# "conv.ovf.i1" value : sbyte #) + when ^T : int16 = (# "conv.ovf.i1" value : sbyte #) + when ^T : nativeint = (# "conv.ovf.i1" value : sbyte #) + when ^T : sbyte = (# "" value : sbyte #) + when ^T : uint64 = (# "conv.ovf.i1.un" value : sbyte #) + when ^T : uint32 = (# "conv.ovf.i1.un" value : sbyte #) + when ^T : uint16 = (# "conv.ovf.i1.un" value : sbyte #) + when ^T : char = (# "conv.ovf.i1.un" value : sbyte #) when ^T : unativeint = (# "conv.ovf.i1.un" value : sbyte #) - when ^T : byte = (# "conv.ovf.i1.un" value : sbyte #) + when ^T : byte = (# "conv.ovf.i1.un" value : sbyte #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> sbyte) (value)) [] [] let inline uint16 (value: ^T) = - ExplicitDynamic<(^T),uint16> value + CheckedExplicitDynamic<(^T),uint16> value when ^T : string = ParseUInt16 (castToString value) when ^T : float = (# "conv.ovf.u2" value : uint16 #) when ^T : float32 = (# "conv.ovf.u2" value : uint16 #) @@ -5074,8 +5336,8 @@ namespace Microsoft.FSharp.Core when ^T : sbyte = (# "conv.ovf.u2" value : uint16 #) when ^T : uint64 = (# "conv.ovf.u2.un" value : uint16 #) when ^T : uint32 = (# "conv.ovf.u2.un" value : uint16 #) - when ^T : uint16 = (# "conv.ovf.u2.un" value : uint16 #) - when ^T : char = (# "conv.ovf.u2.un" value : uint16 #) + when ^T : uint16 = (# "" value : uint16 #) + when ^T : char = (# "" value : uint16 #) when ^T : unativeint = (# "conv.ovf.u2.un" value : uint16 #) when ^T : byte = (# "conv.ovf.u2.un" value : uint16 #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> uint16) (value)) @@ -5083,7 +5345,7 @@ namespace Microsoft.FSharp.Core [] [] let inline char (value: ^T) = - ExplicitDynamic<(^T), char> value + CheckedExplicitDynamic<(^T), char> value when ^T : string = (Char.Parse(castToString value)) when ^T : float = (# "conv.ovf.u2" value : char #) when ^T : float32 = (# "conv.ovf.u2" value : char #) @@ -5094,8 +5356,8 @@ namespace Microsoft.FSharp.Core when ^T : sbyte = (# "conv.ovf.u2" value : char #) when ^T : uint64 = (# "conv.ovf.u2.un" value : char #) when ^T : uint32 = (# "conv.ovf.u2.un" value : char #) - when ^T : uint16 = (# "conv.ovf.u2.un" value : char #) - when ^T : char = (# "conv.ovf.u2.un" value : char #) + when ^T : uint16 = (# "" value : char #) + when ^T : char = (# "" value : char #) when ^T : unativeint = (# "conv.ovf.u2.un" value : char #) when ^T : byte = (# "conv.ovf.u2.un" value : char #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> char) (value)) @@ -5103,61 +5365,61 @@ namespace Microsoft.FSharp.Core [] [] let inline int16 (value: ^T) = - ExplicitDynamic<(^T), int16> value - when ^T : string = ParseInt16 (castToString value) - when ^T : float = (# "conv.ovf.i2" value : int16 #) - when ^T : float32 = (# "conv.ovf.i2" value : int16 #) - when ^T : int64 = (# "conv.ovf.i2" value : int16 #) - when ^T : int32 = (# "conv.ovf.i2" value : int16 #) - when ^T : int16 = (# "conv.ovf.i2" value : int16 #) - when ^T : nativeint = (# "conv.ovf.i2" value : int16 #) - when ^T : sbyte = (# "conv.ovf.i2" value : int16 #) - when ^T : uint64 = (# "conv.ovf.i2.un" value : int16 #) - when ^T : uint32 = (# "conv.ovf.i2.un" value : int16 #) - when ^T : uint16 = (# "conv.ovf.i2.un" value : int16 #) - when ^T : char = (# "conv.ovf.i2.un" value : int16 #) + CheckedExplicitDynamic<(^T), int16> value + when ^T : string = ParseInt16 (castToString value) + when ^T : float = (# "conv.ovf.i2" value : int16 #) + when ^T : float32 = (# "conv.ovf.i2" value : int16 #) + when ^T : int64 = (# "conv.ovf.i2" value : int16 #) + when ^T : int32 = (# "conv.ovf.i2" value : int16 #) + when ^T : int16 = (# "" value : int16 #) + when ^T : nativeint = (# "conv.ovf.i2" value : int16 #) + when ^T : sbyte = (# "conv.ovf.i2" value : int16 #) + when ^T : uint64 = (# "conv.ovf.i2.un" value : int16 #) + when ^T : uint32 = (# "conv.ovf.i2.un" value : int16 #) + when ^T : uint16 = (# "conv.ovf.i2.un" value : int16 #) + when ^T : char = (# "conv.ovf.i2.un" value : int16 #) when ^T : unativeint = (# "conv.ovf.i2.un" value : int16 #) - when ^T : byte = (# "conv.ovf.i2.un" value : int16 #) + when ^T : byte = (# "conv.ovf.i2.un" value : int16 #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> int16) (value)) [] [] let inline uint32 (value: ^T) = - ExplicitDynamic<(^T), uint32> value - when ^T : string = ParseUInt32 (castToString value) - when ^T : float = (# "conv.ovf.u4" value : uint32 #) - when ^T : float32 = (# "conv.ovf.u4" value : uint32 #) - when ^T : int64 = (# "conv.ovf.u4" value : uint32 #) - when ^T : int32 = (# "conv.ovf.u4" value : uint32 #) - when ^T : int16 = (# "conv.ovf.u4" value : uint32 #) - when ^T : nativeint = (# "conv.ovf.u4" value : uint32 #) - when ^T : sbyte = (# "conv.ovf.u4" value : uint32 #) - when ^T : uint64 = (# "conv.ovf.u4.un" value : uint32 #) - when ^T : uint32 = (# "conv.ovf.u4.un" value : uint32 #) - when ^T : uint16 = (# "conv.ovf.u4.un" value : uint32 #) - when ^T : char = (# "conv.ovf.u4.un" value : uint32 #) + CheckedExplicitDynamic<(^T), uint32> value + when ^T : string = ParseUInt32 (castToString value) + when ^T : float = (# "conv.ovf.u4" value : uint32 #) + when ^T : float32 = (# "conv.ovf.u4" value : uint32 #) + when ^T : int64 = (# "conv.ovf.u4" value : uint32 #) + when ^T : int32 = (# "conv.ovf.u4" value : uint32 #) + when ^T : int16 = (# "conv.ovf.u4" value : uint32 #) + when ^T : nativeint = (# "conv.ovf.u4" value : uint32 #) + when ^T : sbyte = (# "conv.ovf.u4" value : uint32 #) + when ^T : uint64 = (# "conv.ovf.u4.un" value : uint32 #) + when ^T : uint32 = (# "" value : uint32 #) + when ^T : uint16 = (# "conv.ovf.u4.un" value : uint32 #) + when ^T : char = (# "conv.ovf.u4.un" value : uint32 #) when ^T : unativeint = (# "conv.ovf.u4.un" value : uint32 #) - when ^T : byte = (# "conv.ovf.u4.un" value : uint32 #) + when ^T : byte = (# "conv.ovf.u4.un" value : uint32 #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> uint32) (value)) [] [] let inline int32 (value: ^T) = - ExplicitDynamic<(^T), int32> value - when ^T : string = ParseInt32 (castToString value) - when ^T : float = (# "conv.ovf.i4" value : int32 #) - when ^T : float32 = (# "conv.ovf.i4" value : int32 #) - when ^T : int64 = (# "conv.ovf.i4" value : int32 #) - when ^T : int32 = (# "conv.ovf.i4" value : int32 #) - when ^T : int16 = (# "conv.ovf.i4" value : int32 #) - when ^T : nativeint = (# "conv.ovf.i4" value : int32 #) - when ^T : sbyte = (# "conv.ovf.i4" value : int32 #) - when ^T : uint64 = (# "conv.ovf.i4.un" value : int32 #) - when ^T : uint32 = (# "conv.ovf.i4.un" value : int32 #) - when ^T : uint16 = (# "conv.ovf.i4.un" value : int32 #) - when ^T : char = (# "conv.ovf.i4.un" value : int32 #) + CheckedExplicitDynamic<(^T), int32> value + when ^T : string = ParseInt32 (castToString value) + when ^T : float = (# "conv.ovf.i4" value : int32 #) + when ^T : float32 = (# "conv.ovf.i4" value : int32 #) + when ^T : int64 = (# "conv.ovf.i4" value : int32 #) + when ^T : int32 = (# "" value : int32 #) + when ^T : int16 = (# "conv.ovf.i4" value : int32 #) + when ^T : nativeint = (# "conv.ovf.i4" value : int32 #) + when ^T : sbyte = (# "conv.ovf.i4" value : int32 #) + when ^T : uint64 = (# "conv.ovf.i4.un" value : int32 #) + when ^T : uint32 = (# "conv.ovf.i4.un" value : int32 #) + when ^T : uint16 = (# "conv.ovf.i4.un" value : int32 #) + when ^T : char = (# "conv.ovf.i4.un" value : int32 #) when ^T : unativeint = (# "conv.ovf.i4.un" value : int32 #) - when ^T : byte = (# "conv.ovf.i4.un" value : int32 #) + when ^T : byte = (# "conv.ovf.i4.un" value : int32 #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> int32) (value)) [] @@ -5166,81 +5428,83 @@ namespace Microsoft.FSharp.Core [] [] let inline uint64 (value: ^T) = - ExplicitDynamic<(^T), uint64> value - when ^T : string = ParseUInt64 (castToString value) - when ^T : float = (# "conv.ovf.u8" value : uint64 #) - when ^T : float32 = (# "conv.ovf.u8" value : uint64 #) - when ^T : int64 = (# "conv.ovf.u8" value : uint64 #) - when ^T : int32 = (# "conv.ovf.u8" value : uint64 #) - when ^T : int16 = (# "conv.ovf.u8" value : uint64 #) - when ^T : nativeint = (# "conv.ovf.u8" value : uint64 #) - when ^T : sbyte = (# "conv.ovf.u8" value : uint64 #) - when ^T : uint64 = (# "conv.ovf.u8.un" value : uint64 #) - when ^T : uint32 = (# "conv.ovf.u8.un" value : uint64 #) - when ^T : uint16 = (# "conv.ovf.u8.un" value : uint64 #) - when ^T : char = (# "conv.ovf.u8.un" value : uint64 #) + CheckedExplicitDynamic<(^T), uint64> value + when ^T : string = ParseUInt64 (castToString value) + when ^T : float = (# "conv.ovf.u8" value : uint64 #) + when ^T : float32 = (# "conv.ovf.u8" value : uint64 #) + when ^T : int64 = (# "conv.ovf.u8" value : uint64 #) + when ^T : int32 = (# "conv.ovf.u8" value : uint64 #) + when ^T : int16 = (# "conv.ovf.u8" value : uint64 #) + when ^T : nativeint = (# "conv.ovf.u8" value : uint64 #) + when ^T : sbyte = (# "conv.ovf.u8" value : uint64 #) + when ^T : uint64 = (# "" value : uint64 #) + when ^T : uint32 = (# "conv.ovf.u8.un" value : uint64 #) + when ^T : uint16 = (# "conv.ovf.u8.un" value : uint64 #) + when ^T : char = (# "conv.ovf.u8.un" value : uint64 #) when ^T : unativeint = (# "conv.ovf.u8.un" value : uint64 #) - when ^T : byte = (# "conv.ovf.u8.un" value : uint64 #) + when ^T : byte = (# "conv.ovf.u8.un" value : uint64 #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> uint64) (value)) [] [] let inline int64 (value: ^T) = - ExplicitDynamic<(^T), int64> value - when ^T : string = ParseInt64 (castToString value) - when ^T : float = (# "conv.ovf.i8" value : int64 #) - when ^T : float32 = (# "conv.ovf.i8" value : int64 #) - when ^T : int64 = (# "conv.ovf.i8" value : int64 #) - when ^T : int32 = (# "conv.ovf.i8" value : int64 #) - when ^T : int16 = (# "conv.ovf.i8" value : int64 #) - when ^T : nativeint = (# "conv.ovf.i8" value : int64 #) - when ^T : sbyte = (# "conv.ovf.i8" value : int64 #) - when ^T : uint64 = (# "conv.ovf.i8.un" value : int64 #) - when ^T : uint32 = (# "conv.ovf.i8.un" value : int64 #) - when ^T : uint16 = (# "conv.ovf.i8.un" value : int64 #) - when ^T : char = (# "conv.ovf.i8.un" value : int64 #) + CheckedExplicitDynamic<(^T), int64> value + when ^T : string = ParseInt64 (castToString value) + when ^T : float = (# "conv.ovf.i8" value : int64 #) + when ^T : float32 = (# "conv.ovf.i8" value : int64 #) + when ^T : int64 = (# "" value : int64 #) + when ^T : int32 = (# "conv.ovf.i8" value : int64 #) + when ^T : int16 = (# "conv.ovf.i8" value : int64 #) + when ^T : nativeint = (# "conv.ovf.i8" value : int64 #) + when ^T : sbyte = (# "conv.ovf.i8" value : int64 #) + when ^T : uint64 = (# "conv.ovf.i8.un" value : int64 #) + when ^T : uint32 = (# "conv.ovf.i8.un" value : int64 #) + when ^T : uint16 = (# "conv.ovf.i8.un" value : int64 #) + when ^T : char = (# "conv.ovf.i8.un" value : int64 #) when ^T : unativeint = (# "conv.ovf.i8.un" value : int64 #) - when ^T : byte = (# "conv.ovf.i8.un" value : int64 #) + when ^T : byte = (# "conv.ovf.i8.un" value : int64 #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> int64) (value)) [] [] let inline unativeint (value: ^T) = - ExplicitDynamic<(^T), unativeint> value - when ^T : string = ParseUIntPtr (castToString value) - when ^T : float = (# "conv.ovf.u" value : unativeint #) - when ^T : float32 = (# "conv.ovf.u" value : unativeint #) - when ^T : int64 = (# "conv.ovf.u" value : unativeint #) - when ^T : int32 = (# "conv.ovf.u" value : unativeint #) - when ^T : int16 = (# "conv.ovf.u" value : unativeint #) - when ^T : nativeint = (# "conv.ovf.u" value : unativeint #) - when ^T : sbyte = (# "conv.ovf.u" value : unativeint #) - when ^T : uint64 = (# "conv.ovf.u.un" value : unativeint #) - when ^T : uint32 = (# "conv.ovf.u.un" value : unativeint #) - when ^T : uint16 = (# "conv.ovf.u.un" value : unativeint #) - when ^T : char = (# "conv.ovf.u.un" value : unativeint #) - when ^T : unativeint = (# "conv.ovf.u.un" value : unativeint #) - when ^T : byte = (# "conv.ovf.u.un" value : unativeint #) + CheckedExplicitDynamic<(^T), unativeint> value + when ^T : string = ParseUIntPtr (castToString value) + when ^T : float = (# "conv.ovf.u" value : unativeint #) + when ^T : float32 = (# "conv.ovf.u" value : unativeint #) + when ^T : int64 = (# "conv.ovf.u" value : unativeint #) + when ^T : int32 = (# "conv.ovf.u" value : unativeint #) + when ^T : int16 = (# "conv.ovf.u" value : unativeint #) + when ^T : nativeint = (# "conv.ovf.u" value : unativeint #) + when ^T : sbyte = (# "conv.ovf.u" value : unativeint #) + when ^T : uint64 = (# "conv.ovf.u.un" value : unativeint #) + when ^T : uint32 = (# "conv.ovf.u.un" value : unativeint #) + when ^T : uint16 = (# "conv.ovf.u.un" value : unativeint #) + when ^T : char = (# "conv.ovf.u.un" value : unativeint #) + when ^T : unativeint = (# "" value : unativeint #) + when ^T : byte = (# "conv.ovf.u.un" value : unativeint #) + when ^T : decimal = (# "conv.ovf.u.un" (uint64 (# "" value : decimal #)) : unativeint #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> unativeint) (value)) [] [] let inline nativeint (value: ^T) = - ExplicitDynamic<(^T), nativeint> value - when ^T : string = ParseIntPtr (castToString value) - when ^T : float = (# "conv.ovf.i" value : nativeint #) - when ^T : float32 = (# "conv.ovf.i" value : nativeint #) - when ^T : int64 = (# "conv.ovf.i" value : nativeint #) - when ^T : int32 = (# "conv.ovf.i" value : nativeint #) - when ^T : int16 = (# "conv.ovf.i" value : nativeint #) - when ^T : nativeint = (# "conv.ovf.i" value : nativeint #) - when ^T : sbyte = (# "conv.ovf.i" value : nativeint #) - when ^T : uint64 = (# "conv.ovf.i.un" value : nativeint #) - when ^T : uint32 = (# "conv.ovf.i.un" value : nativeint #) - when ^T : uint16 = (# "conv.ovf.i.un" value : nativeint #) - when ^T : char = (# "conv.ovf.i.un" value : nativeint #) + CheckedExplicitDynamic<(^T), nativeint> value + when ^T : string = ParseIntPtr (castToString value) + when ^T : float = (# "conv.ovf.i" value : nativeint #) + when ^T : float32 = (# "conv.ovf.i" value : nativeint #) + when ^T : int64 = (# "conv.ovf.i" value : nativeint #) + when ^T : int32 = (# "conv.ovf.i" value : nativeint #) + when ^T : int16 = (# "conv.ovf.i" value : nativeint #) + when ^T : nativeint = (# "" value : nativeint #) + when ^T : sbyte = (# "conv.ovf.i" value : nativeint #) + when ^T : uint64 = (# "conv.ovf.i.un" value : nativeint #) + when ^T : uint32 = (# "conv.ovf.i.un" value : nativeint #) + when ^T : uint16 = (# "conv.ovf.i.un" value : nativeint #) + when ^T : char = (# "conv.ovf.i.un" value : nativeint #) when ^T : unativeint = (# "conv.ovf.i.un" value : nativeint #) - when ^T : byte = (# "conv.ovf.i.un" value : nativeint #) + when ^T : byte = (# "conv.ovf.i.un" value : nativeint #) + when ^T : decimal = (# "conv.ovf.i" (int64 (# "" value : decimal #)) : nativeint #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> nativeint) (value)) module OperatorIntrinsics = diff --git a/src/FSharp.Core/prim-types.fsi b/src/FSharp.Core/prim-types.fsi index 70ee63e0c2d..a2c03fa1025 100644 --- a/src/FSharp.Core/prim-types.fsi +++ b/src/FSharp.Core/prim-types.fsi @@ -1542,6 +1542,10 @@ namespace Microsoft.FSharp.Core [] val ExplicitDynamic: value: 'T -> 'U + /// A compiler intrinsic that implements dynamic invocations related to checked conversion operators. + [] + val CheckedExplicitDynamic : value:'T -> 'U + /// A compiler intrinsic that implements dynamic invocations related to the '<' operator. [] val LessThanDynamic: x: 'T1 -> y: 'T2 -> 'U diff --git a/src/FSharp.Core/quotations.fs b/src/FSharp.Core/quotations.fs index 54ca7e2e3c4..44c625de5f5 100644 --- a/src/FSharp.Core/quotations.fs +++ b/src/FSharp.Core/quotations.fs @@ -1408,11 +1408,11 @@ module Patterns = | Unique of 'T | Ambiguous of 'R - let typeEquals (s: Type) (t: Type) = - s.Equals t + let typeEquals (ty1: Type) (ty2: Type) = + ty1.Equals ty2 - let typesEqual (ss: Type list) (tt: Type list) = - (ss.Length = tt.Length) && List.forall2 typeEquals ss tt + let typesEqual (tys1: Type list) (tys2: Type list) = + (tys1.Length = tys2.Length) && List.forall2 typeEquals tys1 tys2 let instFormal (typarEnv: Type[]) (ty: Instantiable<'T>) = ty (fun i -> typarEnv.[i]) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/UnionTypes/E_LowercaseWhenRequireQualifiedAccess.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/UnionTypes/E_LowercaseWhenRequireQualifiedAccess.fsx new file mode 100644 index 00000000000..a7e7a928e36 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnionTypes/E_LowercaseWhenRequireQualifiedAccess.fsx @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + + + + +type DU1 = | ``not.allowed`` + +type DU2 = ``not.allowed`` + +[] +type DU3 = | ``not.allowed`` + +[] +type DU4 = ``not.allowed`` + +type DU5 = | a + +type DU6 = a + +type du1 = du1 of string + +type du2 = | du2 of string \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/UnionTypes/LowercaseWhenRequireQualifiedAccess.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/UnionTypes/LowercaseWhenRequireQualifiedAccess.fsx new file mode 100644 index 00000000000..e9080c19964 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnionTypes/LowercaseWhenRequireQualifiedAccess.fsx @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + + + + +[] +type DU1 = + | a + | b + | c + +[] +type DU2 = + | a of int + | B of string + | C + +[] +type DU3 = | a + +[] +type DU4 = a + +[] +type du1 = du1 of string + +[] +type du2 = | du2 of string + +let a = DU1.a +let b = du2.du2 +let c = DU2.a(1) +let d = du2.du2("du2") +let e = du1.du1("du1") + +let f du1 = + match du1 with + | DU1.a -> () + | DU1.b -> () + | DU1.c -> () + +f DU1.c + + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/UnionTypes/UnionTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnionTypes/UnionTypes.fs index 1e27322bfbd..39f4fac3804 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/UnionTypes/UnionTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnionTypes/UnionTypes.fs @@ -509,6 +509,64 @@ module UnionTypes = |> verifyCompileAndRun |> shouldSucceed + //SOURCE=LowercaseWhenRequireQualifiedAccess.fsx # LowercaseWhenRequireQualifiedAccess.fsx + [] + let ``LowercaseWhenRequireQualifiedAccess_fs in langversion 6`` compilation = + compilation + |> withLangVersion60 + |> verifyCompile + |> shouldFail + + //SOURCE=LowercaseWhenRequireQualifiedAccess.fsx # LowercaseWhenRequireQualifiedAccess.fsx + [] + let ``LowercaseWhenRequireQualifiedAccess_fs in preview`` compilation = + compilation + |> withLangVersionPreview + |> verifyCompileAndRun + |> shouldSucceed + + //SOURCE=E_LowercaseWhenRequireQualifiedAccess.fsx # E_LowercaseWhenRequireQualifiedAccess.fsx + [] + let ``E_LowercaseWhenRequireQualifiedAccess_fs in preview`` compilation = + compilation + |> withLangVersionPreview + |> verifyCompile + |> shouldFail + |> withDiagnostics [ + (Error 883, Line 6, Col 14, Line 6, Col 29, "Invalid namespace, module, type or union case name"); + (Error 53, Line 6, Col 14, Line 6, Col 29, "Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute"); + (Error 883, Line 8, Col 12, Line 8, Col 27, "Invalid namespace, module, type or union case name"); + (Error 53, Line 8, Col 12, Line 8, Col 27, "Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute"); + (Error 883, Line 11, Col 14, Line 11, Col 29, "Invalid namespace, module, type or union case name"); + (Error 883, Line 14, Col 12, Line 14, Col 27, "Invalid namespace, module, type or union case name"); + (Error 53, Line 16, Col 14, Line 16, Col 15, "Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute"); + (Error 53, Line 18, Col 12, Line 18, Col 13, "Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute"); + (Error 53, Line 20, Col 12, Line 20, Col 15, "Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute"); + (Error 53, Line 22, Col 14, Line 22, Col 17, "Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute") + ] + + //SOURCE=E_LowercaseWhenRequireQualifiedAccess.fsx # E_LowercaseWhenRequireQualifiedAccess.fsx + [] + let ``E_LowercaseWhenRequireQualifiedAccess_fs in langversion 6`` compilation = + compilation + |> withLangVersion60 + |> verifyCompile + |> shouldFail + |> withDiagnostics [ + (Error 883, Line 6, Col 14, Line 6, Col 29, "Invalid namespace, module, type or union case name"); + (Error 53, Line 6, Col 14, Line 6, Col 29, "Discriminated union cases and exception labels must be uppercase identifiers"); + (Error 883, Line 8, Col 12, Line 8, Col 27, "Invalid namespace, module, type or union case name"); + (Error 53, Line 8, Col 12, Line 8, Col 27, "Discriminated union cases and exception labels must be uppercase identifiers"); + (Error 883, Line 11, Col 14, Line 11, Col 29, "Invalid namespace, module, type or union case name"); + (Error 53, Line 11, Col 14, Line 11, Col 29, "Discriminated union cases and exception labels must be uppercase identifiers"); + (Error 883, Line 14, Col 12, Line 14, Col 27, "Invalid namespace, module, type or union case name"); + (Error 53, Line 14, Col 12, Line 14, Col 27, "Discriminated union cases and exception labels must be uppercase identifiers"); + (Error 53, Line 16, Col 14, Line 16, Col 15, "Discriminated union cases and exception labels must be uppercase identifiers"); + (Error 53, Line 18, Col 12, Line 18, Col 13, "Discriminated union cases and exception labels must be uppercase identifiers"); + (Error 53, Line 20, Col 12, Line 20, Col 15, "Discriminated union cases and exception labels must be uppercase identifiers"); + (Error 53, Line 22, Col 14, Line 22, Col 17, "Discriminated union cases and exception labels must be uppercase identifiers") + ] + //SOURCE=W_GenericFunctionValuedStaticProp02.fs SCFLAGS="--test:ErrorRanges --warnaserror-" # W_GenericFunctionValuedStaticProp02.fs [] let ``W_GenericFunctionValuedStaticProp02_fs`` compilation = diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare06.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare06.fsx.il.bsl index 30f333f36c8..b7aea842a83 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare06.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare06.fsx.il.bsl @@ -66,8 +66,10 @@ { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 02 00 00 00 00 00 ) .field assembly int32 key1@ + .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [System.Runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field assembly int32 key2@ + .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [System.Runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .method public hidebysig specialname instance int32 get_key1() cil managed diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals05.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals05.fsx.il.bsl index 78d4df8f587..34ab1b1e85c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals05.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals05.fsx.il.bsl @@ -66,8 +66,10 @@ { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 02 00 00 00 00 00 ) .field assembly int32 key1@ + .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [System.Runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field assembly int32 key2@ + .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [System.Runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .method public hidebysig specialname instance int32 get_key1() cil managed diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash08.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash08.fsx.il.bsl index b23967fe77b..c94a00b3427 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash08.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash08.fsx.il.bsl @@ -66,8 +66,10 @@ { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 02 00 00 00 00 00 ) .field assembly int32 key1@ + .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [System.Runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field assembly int32 key2@ + .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [System.Runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .method public hidebysig specialname instance int32 get_key1() cil managed diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/AnonRecd.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/AnonRecd.fs.il.bsl index 0b4d87cf293..31112ecefe0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/AnonRecd.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/AnonRecd.fs.il.bsl @@ -99,8 +99,10 @@ .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 02 00 00 00 00 00 ) .field private !'j__TPar' A@ + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field private !'j__TPar' B@ + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .method public specialname rtspecialname instance void .ctor(!'j__TPar' A, diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction17.fs.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction17.fs.il.debug.bsl index ded94e51adc..de3a5062203 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction17.fs.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction17.fs.il.debug.bsl @@ -62,8 +62,10 @@ { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 02 00 00 00 00 00 ) .field assembly int32 x@ + .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [System.Runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field assembly int32 y@ + .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [System.Runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .method public hidebysig specialname instance int32 get_x() cil managed diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction17.fs.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction17.fs.il.release.bsl index d34dc778f67..17ff542c4ed 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction17.fs.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction17.fs.il.release.bsl @@ -62,8 +62,10 @@ { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 02 00 00 00 00 00 ) .field assembly int32 x@ + .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [System.Runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field assembly int32 y@ + .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [System.Runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .method public hidebysig specialname instance int32 get_x() cil managed diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction24.fs.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction24.fs.il.debug.bsl index 1139c1cdb0d..6047356613b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction24.fs.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction24.fs.il.debug.bsl @@ -62,8 +62,10 @@ { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 02 00 00 00 00 00 ) .field public int32 x@ + .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [System.Runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field public int32 y@ + .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [System.Runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .method public hidebysig specialname instance int32 get_x() cil managed diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction24.fs.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction24.fs.il.release.bsl index 51afb9c71dd..97404f6bb4a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction24.fs.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction24.fs.il.release.bsl @@ -62,8 +62,10 @@ { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 02 00 00 00 00 00 ) .field public int32 x@ + .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [System.Runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field public int32 y@ + .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [System.Runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .method public hidebysig specialname instance int32 get_x() cil managed diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj b/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj index 42a431f2c27..9c0017aaed1 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj +++ b/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj @@ -42,6 +42,7 @@ + diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule1.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule1.fs index 62db48e2ec9..a7672d9925f 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule1.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule1.fs @@ -246,10 +246,10 @@ type OperatorsModule1() = Assert.AreEqual(1, intbox) // string value - let stringlbox = Operators.box "string" - Assert.AreEqual("string", stringlbox) + let stringbox = Operators.box "string" + Assert.AreEqual("string", stringbox) - // null value + // null value let nullbox = Operators.box null CheckThrowsNullRefException(fun () -> nullbox.ToString() |> ignore) @@ -275,6 +275,14 @@ type OperatorsModule1() = let result = Operators.byte Int64.MinValue Assert.AreEqual(0uy, result) + // Overflow + let result = Operators.byte Single.MinValue + Assert.AreEqual(0uy, result) + + // Overflow + let result = Operators.byte Single.MaxValue + Assert.AreEqual(0uy, result) + // Overflow let result = Operators.byte Double.MinValue Assert.AreEqual(0uy, result) @@ -292,7 +300,7 @@ type OperatorsModule1() = Assert.AreEqual(4uy, result) // OverflowException, from decimal is always checked - CheckThrowsOverflowException(fun() -> Operators.byte Decimal.MinValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.byte Decimal.MinValue |> ignore) [] member _.ceil() = @@ -301,18 +309,44 @@ type OperatorsModule1() = Assert.AreEqual(1.0, minceil) // normal value - let normalceil = Operators.ceil 100.0 - Assert.AreEqual(100.0, normalceil) + let normalceil = Operators.ceil 100.1 + Assert.AreEqual(101.0, normalceil) // max value let maxceil = Operators.ceil 1.7E+308 Assert.AreEqual(1.7E+308, maxceil) + // float32 value + let float32ceil = Operators.ceil 100.1f + Assert.AreEqual(101f, float32ceil) + + // decimal value + let decimalceil = Operators.ceil 100.1m + Assert.AreEqual(101m, decimalceil) + [] member _.char() = // int type - let intchar = Operators.char 48 - Assert.AreEqual('0', intchar) + Assert.AreEqual('0', Operators.char 48) + Assert.AreEqual('0', Operators.char 48u) + Assert.AreEqual('0', Operators.char 48s) + Assert.AreEqual('0', Operators.char 48us) + Assert.AreEqual('0', Operators.char 48y) + Assert.AreEqual('0', Operators.char 48uy) + Assert.AreEqual('0', Operators.char 48L) + Assert.AreEqual('0', Operators.char 48uL) + Assert.AreEqual('0', Operators.char 48n) + Assert.AreEqual('0', Operators.char 48un) + Assert.AreEqual('0', Operators.char 48f) + Assert.AreEqual('0', Operators.char 48.) + Assert.AreEqual('0', Operators.char 48m) + + // Overflow + Assert.AreEqual('\000', Operators.char Single.MinValue) + Assert.AreEqual('\000', Operators.char Double.MinValue) + Assert.AreEqual('\000', Operators.char Single.MaxValue) + Assert.AreEqual('\000', Operators.char Double.MaxValue) + CheckThrowsOverflowException(fun () -> Operators.char Decimal.MinValue |> ignore) // string type let stringchar = Operators.char " " @@ -366,12 +400,24 @@ type OperatorsModule1() = member _.decimal () = // int value - let mindecimal = Operators.decimal (1) - Assert.AreEqual(1M, mindecimal) + let intdecimal = Operators.decimal (1) + Assert.AreEqual(1M, intdecimal) + + // nativeint value + let nativeintdecimal = Operators.decimal 1n + Assert.AreEqual(1M, nativeintdecimal) + + // unativeint value + let unativeintdecimal = Operators.decimal 1un + Assert.AreEqual(1M, unativeintdecimal) + + // char value + let chardecimal = Operators.decimal '\001' + Assert.AreEqual(1M, chardecimal) - // float value - let maxdecimal = Operators.decimal (1.0) - Assert.AreEqual(1M, maxdecimal) + // float value + let floatdecimal = Operators.decimal (1.0) + Assert.AreEqual(1M, floatdecimal) [] member _.decr() = @@ -416,6 +462,10 @@ type OperatorsModule1() = // char type let chardouble = Operators.float '0' Assert.AreEqual(48.0, chardouble) + + // decimal type + let decimaldouble = Operators.float 100m + Assert.AreEqual(100.0, decimaldouble) [] member _.enum() = @@ -424,7 +474,7 @@ type OperatorsModule1() = let intenum = Operators.enum intarg Assert.AreEqual(System.ConsoleColor.Black, intenum) - // big number + // big number let bigarg : int32 = 15 let charenum = Operators.enum bigarg Assert.AreEqual(System.ConsoleColor.White, charenum) @@ -488,6 +538,10 @@ type OperatorsModule1() = let charfloat = Operators.float '0' Assert.AreEqual((float)48, charfloat) + // decimal type + let intfloat = Operators.float 100m + Assert.AreEqual((float)100, intfloat) + [] member _.float32() = // int type @@ -497,16 +551,24 @@ type OperatorsModule1() = // char type let charfloat32 = Operators.float32 '0' Assert.AreEqual((float32)48, charfloat32) + + // decimal type + let intfloat32 = Operators.float32 100m + Assert.AreEqual((float32)100, intfloat32) [] member _.floor() = // float type - let intfloor = Operators.floor 100.9 - Assert.AreEqual(100.0, intfloor) + let floatfloor = Operators.floor 100.9 + Assert.AreEqual(100.0, floatfloor) // float32 type - let charfloor = Operators.floor ((float32)100.9) - Assert.AreEqual(100.0f, charfloor) + let float32floor = Operators.floor 100.9f + Assert.AreEqual(100.0f, float32floor) + + // decimal type + let decimalfloor = Operators.floor 100.9m + Assert.AreEqual(100m, decimalfloor) [] member _.fst() = diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule2.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule2.fs index 3abdeee4121..d4197529ea6 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule2.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule2.fs @@ -51,6 +51,14 @@ type OperatorsModule2() = let result = Operators.int 0 Assert.AreEqual(0, result) + // Overflow. + let result = Operators.int Single.MaxValue + Assert.AreEqual(Int32.MinValue, result) + + // Overflow + let result = Operators.int Single.MinValue + Assert.AreEqual(Int32.MinValue, result) + // Overflow let result = Operators.int Double.MaxValue Assert.AreEqual(Int32.MinValue, result) @@ -72,7 +80,7 @@ type OperatorsModule2() = Assert.AreEqual(Int32.MinValue, result) // OverflowException, from decimal is always checked - CheckThrowsOverflowException(fun() -> Operators.int Decimal.MinValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.int Decimal.MinValue |> ignore) [] member _.int16() = @@ -96,6 +104,14 @@ type OperatorsModule2() = let result = Operators.int16 "10" Assert.AreEqual(10s, result) + // Overflow. + let result = Operators.int16 Single.MaxValue + Assert.AreEqual(0s, result) + + // Overflow + let result = Operators.int16 Single.MinValue + Assert.AreEqual(0s, result) + // Overflow let result = Operators.int16 Double.MaxValue Assert.AreEqual(0s, result) @@ -116,7 +132,7 @@ type OperatorsModule2() = Assert.AreEqual(Int16.MinValue, result) // OverflowException, from decimal is always checked - CheckThrowsOverflowException(fun() -> Operators.int16 Decimal.MinValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.int16 Decimal.MinValue |> ignore) [] member _.int32() = @@ -140,6 +156,14 @@ type OperatorsModule2() = let result = Operators.int32 "10" Assert.AreEqual(10, result) + // Overflow. + let result = Operators.int32 Single.MaxValue + Assert.AreEqual(Int32.MinValue, result) + + // Overflow + let result = Operators.int32 Single.MinValue + Assert.AreEqual(Int32.MinValue, result) + // Overflow let result = Operators.int32 Double.MaxValue Assert.AreEqual(Int32.MinValue, result) @@ -161,7 +185,7 @@ type OperatorsModule2() = Assert.AreEqual(Int32.MinValue + 4, result) // OverflowException, from decimal is always checked - CheckThrowsOverflowException(fun() -> Operators.int32 Decimal.MinValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.int32 Decimal.MinValue |> ignore) [] member _.int64() = @@ -185,6 +209,14 @@ type OperatorsModule2() = let result = Operators.int64 "10" Assert.AreEqual(10L, result) + // Overflow. + let result = Operators.int64 Single.MaxValue + Assert.AreEqual(Int64.MinValue, result) + + // Overflow + let result = Operators.int64 Single.MinValue + Assert.AreEqual(Int64.MinValue, result) + // Overflow. let result = Operators.int64 Double.MaxValue Assert.AreEqual(Int64.MinValue, result) @@ -202,11 +234,11 @@ type OperatorsModule2() = Assert.AreEqual(9223372036854775807L, Int64.MaxValue) // OverflowException, from decimal is always checked - CheckThrowsOverflowException(fun() -> Operators.int64 Decimal.MinValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.int64 Decimal.MinValue |> ignore) [] member _.invalidArg() = - CheckThrowsArgumentException(fun() -> Operators.invalidArg "A" "B" |>ignore ) + CheckThrowsArgumentException(fun () -> Operators.invalidArg "A" "B" |>ignore ) [] @@ -328,6 +360,22 @@ type OperatorsModule2() = let result = Operators.nativeint 0 Assert.AreEqual(0n, result) + // Overflow Single.MaxValue is equal on 32 bits and 64 bits runtimes + let result = Operators.nativeint Single.MaxValue + if Info.isX86Runtime then + Assert.AreEqual(-2147483648n, result) + else + // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual(-9223372036854775807n - 1n, result) + + // Overflow (depends on pointer size) + let result = Operators.nativeint Single.MinValue + if Info.isX86Runtime then + Assert.AreEqual(-2147483648n, result) + else + // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual(-9223372036854775807n - 1n, result) + // Overflow Double.MaxValue is equal on 32 bits and 64 bits runtimes let result = Operators.nativeint Double.MaxValue if Info.isX86Runtime then @@ -396,7 +444,7 @@ type OperatorsModule2() = [] member _.nullArg() = - CheckThrowsArgumentNullException(fun() -> Operators.nullArg "A" |> ignore) + CheckThrowsArgumentNullException(fun () -> Operators.nullArg "A" |> ignore) [] @@ -429,11 +477,11 @@ type OperatorsModule2() = let result = Operators.pown System.Double.MaxValue System.Int32.MaxValue Assert.AreEqual(Double.PositiveInfinity, result) - CheckThrowsOverflowException(fun() -> Operators.pown System.Int32.MaxValue System.Int32.MaxValue |>ignore) + CheckThrowsOverflowException(fun () -> Operators.pown System.Int32.MaxValue System.Int32.MaxValue |>ignore) [] member _.raise() = - CheckThrowsArgumentException(fun()-> Operators.raise <| new ArgumentException("Invalid Argument ") |> ignore) + CheckThrowsArgumentException(fun () -> Operators.raise <| new ArgumentException("Invalid Argument ") |> ignore) [] @@ -559,7 +607,7 @@ type OperatorsModule2() = Assert.AreEqual(-128y, result) // OverflowException, from decimal is always checked - CheckThrowsOverflowException(fun() -> Operators.sbyte Decimal.MinValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.sbyte Decimal.MinValue |> ignore) [] member _.sign() = @@ -694,6 +742,10 @@ type OperatorsModule2() = let result = Operators.sizeof Assert.AreEqual(8, result) + // custom struct + let result = Operators.sizeof + Assert.AreEqual(12, result) + // reference type should have the same size as the IntPtr let result = Operators.sizeof Assert.AreEqual(IntPtr.Size, result) @@ -899,9 +951,25 @@ type OperatorsModule2() = // decimal let result = Operators.uint16 100M Assert.AreEqual(100us, result) + + // Overflow + let result = Operators.uint16 Single.MaxValue + Assert.AreEqual(0us, result) + + // Overflow + let result = Operators.uint16 Single.MinValue + Assert.AreEqual(0us, result) + + // Overflow + let result = Operators.uint16 Double.MaxValue + Assert.AreEqual(0us, result) + + // Overflow + let result = Operators.uint16 Double.MinValue + Assert.AreEqual(0us, result) // OverflowException, from decimal is always checked - CheckThrowsOverflowException(fun() -> Operators.uint16 Decimal.MinValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.uint16 Decimal.MinValue |> ignore) [] member _.uint32() = @@ -917,6 +985,14 @@ type OperatorsModule2() = let result = Operators.uint32 100M Assert.AreEqual(100u, result) + // Overflow + let result = Operators.uint32 Single.MaxValue + Assert.AreEqual(0u, result) + + // Overflow + let result = Operators.uint32 Single.MinValue + Assert.AreEqual(0u, result) + // Overflow let result = Operators.uint32 Double.MaxValue Assert.AreEqual(0u, result) @@ -943,7 +1019,7 @@ type OperatorsModule2() = Assert.AreEqual(84ul, result) // OverflowException, from decimal is always checked - CheckThrowsOverflowException(fun() -> Operators.uint32 Decimal.MinValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.uint32 Decimal.MinValue |> ignore) [] member _.uint64() = @@ -959,6 +1035,14 @@ type OperatorsModule2() = let result = Operators.uint64 100M Assert.AreEqual(100UL, result) + // Overflow + let result = Operators.uint64 Single.MaxValue + Assert.AreEqual(0UL, result) + + // Overflow + let result = Operators.uint64 Single.MinValue + Assert.AreEqual(9223372036854775808UL, result) // surprising, but true, 2^63 + 1 + // Overflow let result = Operators.uint64 Double.MaxValue Assert.AreEqual(0UL, result) @@ -980,7 +1064,7 @@ type OperatorsModule2() = Assert.AreEqual(4UL, result) // OverflowException, from decimal is always checked - CheckThrowsOverflowException(fun() -> Operators.uint64 Decimal.MinValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.uint64 Decimal.MinValue |> ignore) [] member _.unativeint() = @@ -993,6 +1077,17 @@ type OperatorsModule2() = let result = Operators.unativeint 100.0 Assert.AreEqual(100un, result) + // Overflow Single.MaxValue is equal on 32 bits and 64 bits runtimes + let result = Operators.unativeint Single.MaxValue + Assert.AreEqual(0un, result) + + // Overflow (depends on pointer size) + let result = Operators.unativeint Single.MinValue + if Info.isX86Runtime then + Assert.AreEqual(0un, result) + else + Assert.AreEqual(9223372036854775808un, result) // surprising, but true, 2^63 + 1 + // Overflow Double.MaxValue is equal on 32 bits and 64 bits runtimes let result = Operators.unativeint Double.MaxValue Assert.AreEqual(0un, result) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleChecked.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleChecked.fs index bcd16f54e27..54da228aca6 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleChecked.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleChecked.fs @@ -21,12 +21,14 @@ type OperatorsModuleChecked() = let charByte = Operators.Checked.byte '0' Assert.AreEqual(48uy, charByte) - // boundary value + // boundary value let boundByte = Operators.Checked.byte 255.0 Assert.AreEqual(255uy, boundByte) // overflow exception CheckThrowsOverflowException(fun () -> Operators.Checked.byte 256 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.byte 256f |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.byte 256. |> ignore) // overflow exception CheckThrowsOverflowException(fun () -> 255uy + 1uy |> ignore) @@ -51,6 +53,8 @@ type OperatorsModuleChecked() = // overflow exception CheckThrowsOverflowException(fun () -> Operators.Checked.char (int64 Char.MaxValue + 1L) |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.char Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.char Double.MaxValue |> ignore) // overflow exception CheckThrowsOverflowException(fun () -> '\uFFFF' + '\u0001' |> ignore) @@ -72,7 +76,9 @@ type OperatorsModuleChecked() = Assert.AreEqual(32767, boundInt) // overflow exception - CheckThrowsOverflowException(fun() -> Operators.Checked.int 2147483648.0 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int 2147483648.0 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int Double.MaxValue |> ignore) // overflow exception CheckThrowsOverflowException(fun () -> Int32.MaxValue + 1 |> ignore) @@ -97,6 +103,8 @@ type OperatorsModuleChecked() = // overflow exception CheckThrowsOverflowException(fun () -> Operators.Checked.int16 32768.0 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int16 Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int16 Double.MaxValue |> ignore) // overflow exception CheckThrowsOverflowException(fun () -> Int16.MaxValue + 1s |> ignore) @@ -121,6 +129,8 @@ type OperatorsModuleChecked() = // overflow exception CheckThrowsOverflowException(fun () -> Operators.Checked.int32 2147483648.0 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int32 Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int32 Double.MaxValue |> ignore) // overflow exception CheckThrowsOverflowException(fun () -> Int32.MaxValue + 1 |> ignore) @@ -150,7 +160,9 @@ type OperatorsModuleChecked() = Assert.AreEqual(-9223372036854775808L, boundInt64) // overflow exception - CheckThrowsOverflowException(fun() -> Operators.Checked.int64 (float Int64.MaxValue + 1.0) |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int64 (float Int64.MaxValue + 1.0) |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int64 Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int64 Double.MaxValue |> ignore) // overflow exception CheckThrowsOverflowException(fun () -> Int64.MaxValue + 1L |> ignore) @@ -179,6 +191,8 @@ type OperatorsModuleChecked() = Operators.Checked.nativeint 2147483648.0 |> ignore else Operators.Checked.nativeint 9223372036854775808.0 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.nativeint Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.nativeint Double.MaxValue |> ignore) [] @@ -198,6 +212,8 @@ type OperatorsModuleChecked() = // overflow exception CheckThrowsOverflowException(fun () -> Operators.Checked.sbyte -256 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.sbyte Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.sbyte Double.MaxValue |> ignore) // overflow exception CheckThrowsOverflowException(fun () -> SByte.MaxValue + 1y |> ignore) @@ -220,7 +236,9 @@ type OperatorsModuleChecked() = let bounduint16 = Operators.Checked.uint16 65535.0 Assert.AreEqual(65535us, bounduint16) - CheckThrowsOverflowException(fun() -> Operators.Checked.uint16 65536.0 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.uint16 65536.0 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.uint16 Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.uint16 Double.MaxValue |> ignore) // overflow exception CheckThrowsOverflowException(fun () -> UInt16.MaxValue + 1us |> ignore) @@ -244,7 +262,9 @@ type OperatorsModuleChecked() = Assert.AreEqual(429496729u, bounduint32) // overflow exception - CheckThrowsOverflowException(fun () -> Operators.Checked.uint32(float UInt32.MaxValue + 1.0) |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.uint32 (float UInt32.MaxValue + 1.0) |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.uint32 Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.uint32 Double.MaxValue |> ignore) // overflow exception CheckThrowsOverflowException(fun () -> UInt32.MaxValue + 1u |> ignore) @@ -269,6 +289,8 @@ type OperatorsModuleChecked() = // overflow exception CheckThrowsOverflowException(fun () -> Operators.Checked.uint64 (float System.UInt64.MaxValue + 1.0) |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.uint64 Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.uint64 Double.MaxValue |> ignore) // overflow exception CheckThrowsOverflowException(fun () -> UInt64.MaxValue + 1UL |> ignore) @@ -302,5 +324,7 @@ type OperatorsModuleChecked() = else Operators.Checked.unativeint (float UInt64.MaxValue + 1.0) |> ignore ) + CheckThrowsOverflowException(fun () -> Operators.Checked.unativeint Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.unativeint Double.MaxValue |> ignore) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleDynamic.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleDynamic.fs new file mode 100644 index 00000000000..9af581dca52 --- /dev/null +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleDynamic.fs @@ -0,0 +1,1105 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +// Sync test content with OperatorsModule1.fs, OperatorsModule2.fs, and OperatorsModuleDynamic.fs + +namespace FSharp.Core.UnitTests.Operators + +open System +open Xunit + +#nowarn "1204" // CompilerMessage: This function is for use by dynamic invocations of F# code and should not be used directly +module OperatorsModuleDynamic = + + /// Check that the lambda throws an exception of the given type. Otherwise + /// calls Assert.Fail() + // Sync implementation with FSharp.Core.UnitTests.LibraryTestFx.CheckThrowsExn + let CheckThrowsExn<'a when 'a :> exn> (f : unit -> unit) = + try + let _ = f () + sprintf "Expected %O exception, got no exception" typeof<'a> |> Assert.Fail + with + | :? 'a -> () + | :? Reflection.TargetInvocationException as r when (r.InnerException :? 'a) -> () + | e -> sprintf "Expected %O or TargetInvocationException containing it, got: %O" typeof<'a> e |> Assert.Fail + let CheckThrowsOverflowException = CheckThrowsExn + + module Operators = + let byte<'T> = LanguagePrimitives.ExplicitDynamic<'T, byte> + let char<'T> = LanguagePrimitives.ExplicitDynamic<'T, char> + let double<'T> = LanguagePrimitives.ExplicitDynamic<'T, double> + let decimal<'T> = LanguagePrimitives.ExplicitDynamic<'T, decimal> + let float<'T> = LanguagePrimitives.ExplicitDynamic<'T, float> + let float32<'T> = LanguagePrimitives.ExplicitDynamic<'T, float32> + let nativeint<'T> = LanguagePrimitives.ExplicitDynamic<'T, nativeint> + let int<'T> = LanguagePrimitives.ExplicitDynamic<'T, int> + let int8<'T> = LanguagePrimitives.ExplicitDynamic<'T, int8> + let int16<'T> = LanguagePrimitives.ExplicitDynamic<'T, int16> + let int32<'T> = LanguagePrimitives.ExplicitDynamic<'T, int32> + let int64<'T> = LanguagePrimitives.ExplicitDynamic<'T, int64> + let sbyte<'T> = LanguagePrimitives.ExplicitDynamic<'T, sbyte> + let single<'T> = LanguagePrimitives.ExplicitDynamic<'T, single> + let uint<'T> = LanguagePrimitives.ExplicitDynamic<'T, uint> + let uint8<'T> = LanguagePrimitives.ExplicitDynamic<'T, uint8> + let uint16<'T> = LanguagePrimitives.ExplicitDynamic<'T, uint16> + let uint32<'T> = LanguagePrimitives.ExplicitDynamic<'T, uint32> + let uint64<'T> = LanguagePrimitives.ExplicitDynamic<'T, uint64> + let unativeint<'T> = LanguagePrimitives.ExplicitDynamic<'T, unativeint> + module Checked = + let byte<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, byte> + let char<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, char> + let double<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, double> + let decimal<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, decimal> + let float<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, float> + let float32<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, float32> + let nativeint<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, nativeint> + let int<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, int> + let int8<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, int8> + let int16<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, int16> + let int32<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, int32> + let int64<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, int64> + let sbyte<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, sbyte> + let single<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, single> + let uint<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, uint> + let uint8<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, uint8> + let uint16<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, uint16> + let uint32<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, uint32> + let uint64<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, uint64> + let unativeint<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, unativeint> + + [] + let byte() = + // int type + let intByte = Operators.byte 100 + Assert.AreEqual(100uy, intByte) + + // char type + let charByte = Operators.byte '0' + Assert.AreEqual(48uy, charByte) + + // boundary value + let boundByte = Operators.byte 255.0 + Assert.AreEqual(255uy, boundByte) + + // Overflow + let result = Operators.byte Int64.MaxValue + Assert.AreEqual(Byte.MaxValue, result) + + // Overflow + let result = Operators.byte Int64.MinValue + Assert.AreEqual(0uy, result) + + // Overflow + let result = Operators.byte Single.MinValue + Assert.AreEqual(0uy, result) + + // Overflow + let result = Operators.byte Single.MaxValue + Assert.AreEqual(0uy, result) + + // Overflow + let result = Operators.byte Double.MinValue + Assert.AreEqual(0uy, result) + + // Overflow + let result = Operators.byte Double.MaxValue + Assert.AreEqual(0uy, result) + + // Overflow + let result = Operators.byte (Int64.MaxValue * 8L) + Assert.AreEqual(248uy, result) // bit-complement + + // Overflow + let result = 255uy + 5uy + Assert.AreEqual(4uy, result) + + // OverflowException, from decimal is always checked + CheckThrowsOverflowException(fun () -> Operators.byte Decimal.MinValue |> ignore) + + [] + let char() = + // int type + Assert.AreEqual('0', Operators.char 48) + Assert.AreEqual('0', Operators.char 48u) + Assert.AreEqual('0', Operators.char 48s) + Assert.AreEqual('0', Operators.char 48us) + Assert.AreEqual('0', Operators.char 48y) + Assert.AreEqual('0', Operators.char 48uy) + Assert.AreEqual('0', Operators.char 48L) + Assert.AreEqual('0', Operators.char 48uL) + Assert.AreEqual('0', Operators.char 48n) + Assert.AreEqual('0', Operators.char 48un) + Assert.AreEqual('0', Operators.char 48f) + Assert.AreEqual('0', Operators.char 48.) + Assert.AreEqual('0', Operators.char 48m) + + // Overflow + Assert.AreEqual('\000', Operators.char Single.MinValue) + Assert.AreEqual('\000', Operators.char Double.MinValue) + Assert.AreEqual('\000', Operators.char Single.MaxValue) + Assert.AreEqual('\000', Operators.char Double.MaxValue) + CheckThrowsOverflowException(fun () -> Operators.char Decimal.MinValue |> ignore) + + // string type + let stringchar = Operators.char " " + Assert.AreEqual(' ', stringchar) + + + [] + let decimal () = + + // int value + let intdecimal = Operators.decimal (1) + Assert.AreEqual(1M, intdecimal) + + // nativeint value + let nativeintdecimal = Operators.decimal 1n + Assert.AreEqual(1M, nativeintdecimal) + + // unativeint value + let unativeintdecimal = Operators.decimal 1un + Assert.AreEqual(1M, unativeintdecimal) + + // char value + let chardecimal = Operators.decimal '\001' + Assert.AreEqual(1M, chardecimal) + + // float value + let floatdecimal = Operators.decimal (1.0) + Assert.AreEqual(1M, floatdecimal) + + [] + let double() = + // int type + let intdouble = Operators.float 100 + Assert.AreEqual(100.0, intdouble) + + // char type + let chardouble = Operators.float '0' + Assert.AreEqual(48.0, chardouble) + + // decimal type + let decimaldouble = Operators.float 100m + Assert.AreEqual(100.0, decimaldouble) + + [] + let float() = + // int type + let intfloat = Operators.float 100 + Assert.AreEqual((float)100, intfloat) + + // char type + let charfloat = Operators.float '0' + Assert.AreEqual((float)48, charfloat) + + // decimal type + let intfloat = Operators.float 100m + Assert.AreEqual((float)100, intfloat) + + [] + let float32() = + // int type + let intfloat32 = Operators.float32 100 + Assert.AreEqual((float32)100, intfloat32) + + // char type + let charfloat32 = Operators.float32 '0' + Assert.AreEqual((float32)48, charfloat32) + + // decimal type + let intfloat32 = Operators.float32 100m + Assert.AreEqual((float32)100, intfloat32) + + [] + let int() = + // int + let result = Operators.int 10 + Assert.AreEqual(10, result) + + // string + let result = Operators.int "10" + Assert.AreEqual(10, result) + + // double + let result = Operators.int 10.0 + Assert.AreEqual(10, result) + + // negative + let result = Operators.int -10 + Assert.AreEqual(-10, result) + + // zero + let result = Operators.int 0 + Assert.AreEqual(0, result) + + // Overflow + let result = Operators.int Single.MaxValue + Assert.AreEqual(Int32.MinValue, result) + + // Overflow + let result = Operators.int Single.MinValue + Assert.AreEqual(Int32.MinValue, result) + + // Overflow + let result = Operators.int Double.MaxValue + Assert.AreEqual(Int32.MinValue, result) + + // Overflow + let result = Operators.int Double.MinValue + Assert.AreEqual(Int32.MinValue, result) + + // Overflow + let result = Operators.int Int64.MaxValue + Assert.AreEqual(-1, result) + + // Overflow + let result = Operators.int Int64.MinValue + Assert.AreEqual(0, result) + + // Overflow + let result = Int32.MaxValue + 1 + Assert.AreEqual(Int32.MinValue, result) + + // OverflowException, from decimal is always checked + CheckThrowsOverflowException(fun () -> Operators.int Decimal.MinValue |> ignore) + + [] + let int16() = + // int + let result = Operators.int16 10 + Assert.AreEqual(10s, result) + + // double + let result = Operators.int16 10.0 + Assert.AreEqual(10s, result) + + // negative + let result = Operators.int16 -10 + Assert.AreEqual(-10s, result) + + // zero + let result = Operators.int16 0 + Assert.AreEqual(0s, result) + + // string + let result = Operators.int16 "10" + Assert.AreEqual(10s, result) + + // Overflow + let result = Operators.int16 Single.MaxValue + Assert.AreEqual(0s, result) + + // Overflow + let result = Operators.int16 Single.MinValue + Assert.AreEqual(0s, result) + + // Overflow + let result = Operators.int16 Double.MaxValue + Assert.AreEqual(0s, result) + + // Overflow + let result = Operators.int16 Double.MinValue + Assert.AreEqual(0s, result) + + let result = Operators.int16 Int64.MaxValue + Assert.AreEqual(-1s, result) + + // Overflow + let result = Operators.int16 Int64.MinValue + Assert.AreEqual(0s, result) + + // Overflow + let result = Int16.MaxValue + 1s + Assert.AreEqual(Int16.MinValue, result) + + // OverflowException, from decimal is always checked + CheckThrowsOverflowException(fun () -> Operators.int16 Decimal.MinValue |> ignore) + + [] + let int32() = + // int + let result = Operators.int32 10 + Assert.AreEqual(10, result) + + // double + let result = Operators.int32 10.0 + Assert.AreEqual(10, result) + + // negative + let result = Operators.int32 -10 + Assert.AreEqual(-10, result) + + // zero + let result = Operators.int32 0 + Assert.AreEqual(0, result) + + // string + let result = Operators.int32 "10" + Assert.AreEqual(10, result) + + // Overflow + let result = Operators.int32 Single.MaxValue + Assert.AreEqual(Int32.MinValue, result) + + // Overflow + let result = Operators.int32 Single.MinValue + Assert.AreEqual(Int32.MinValue, result) + + // Overflow + let result = Operators.int32 Double.MaxValue + Assert.AreEqual(Int32.MinValue, result) + + // Overflow + let result = Operators.int32 Double.MinValue + Assert.AreEqual(Int32.MinValue, result) + + // Overflow + let result = Operators.int32 Int64.MaxValue + Assert.AreEqual(-1, result) + + // Overflow + let result = Operators.int32 Int64.MinValue + Assert.AreEqual(0, result) + + // Overflow + let result = Int32.MaxValue + 5 + Assert.AreEqual(Int32.MinValue + 4, result) + + // OverflowException, from decimal is always checked + CheckThrowsOverflowException(fun () -> Operators.int32 Decimal.MinValue |> ignore) + + [] + let int64() = + // int + let result = Operators.int64 10 + Assert.AreEqual(10L, result) + + // double + let result = Operators.int64 10.0 + Assert.AreEqual(10L, result) + + // negative + let result = Operators.int64 -10 + Assert.AreEqual(-10L, result) + + // zero + let result = Operators.int64 0 + Assert.AreEqual(0L, result) + + // string + let result = Operators.int64 "10" + Assert.AreEqual(10L, result) + + // Overflow. + let result = Operators.int64 Single.MaxValue + Assert.AreEqual(Int64.MinValue, result) + + // Overflow + let result = Operators.int64 Single.MinValue + Assert.AreEqual(Int64.MinValue, result) + + // Overflow. + let result = Operators.int64 Double.MaxValue + Assert.AreEqual(Int64.MinValue, result) + + // Overflow + let result = Operators.int64 Double.MinValue + Assert.AreEqual(Int64.MinValue, result) + + // Overflow + let result = Operators.int64 UInt64.MaxValue + Assert.AreEqual(-1L, result) + + // max and min value as literals (this breaks compilation if the lexer fails) + Assert.AreEqual(-9223372036854775808L, Int64.MinValue) + Assert.AreEqual(9223372036854775807L, Int64.MaxValue) + + // OverflowException, from decimal is always checked + CheckThrowsOverflowException(fun () -> Operators.int64 Decimal.MinValue |> ignore) + + + [] + let nativeint() = + // int + let result = Operators.nativeint 10 + Assert.AreEqual(10n, result) + + // double + let result = Operators.nativeint 10.0 + Assert.AreEqual(10n, result) + + // int64 + let result = Operators.nativeint 10L + Assert.AreEqual(10n, result) + + // negative + let result = Operators.nativeint -10 + Assert.AreEqual(-10n, result) + + // zero + let result = Operators.nativeint 0 + Assert.AreEqual(0n, result) + + // Overflow Double.MaxValue is equal on 32 bits and 64 bits runtimes + let result = Operators.nativeint Single.MaxValue + if Info.isX86Runtime then + Assert.AreEqual(-2147483648n, result) + else + // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual(-9223372036854775807n - 1n, result) + + // Overflow (depends on pointer size) + let result = Operators.nativeint Single.MinValue + if Info.isX86Runtime then + Assert.AreEqual(-2147483648n, result) + else + // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual(-9223372036854775807n - 1n, result) + + // Overflow Double.MaxValue is equal on 32 bits and 64 bits runtimes + let result = Operators.nativeint Double.MaxValue + if Info.isX86Runtime then + Assert.AreEqual(-2147483648n, result) + else + // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual(-9223372036854775807n - 1n, result) + + // Overflow (depends on pointer size) + let result = Operators.nativeint Double.MinValue + if Info.isX86Runtime then + Assert.AreEqual(-2147483648n, result) + else + // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual(-9223372036854775807n - 1n, result) + + // Overflow (depends on pointer size) + let result = Operators.nativeint Int64.MinValue + if Info.isX86Runtime then + Assert.AreEqual(0n, result) + else + // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual(-9223372036854775807n - 1n, result) + + // Overflow (depends on pointer size) + if Info.isX86Runtime then + let result = nativeint Int32.MaxValue + 5n + Assert.AreEqual(-2147483644n, result) + else + let result = nativeint Int64.MaxValue + 5n + Assert.AreEqual(-9223372036854775804n, result) + + // Overflow (depends on pointer size) + let result = Operators.nativeint System.Double.MaxValue + if Info.isX86Runtime then + Assert.AreEqual(-2147483648n, result) + else + // Cannot express this as a literal, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual("-9223372036854775808", string result) + + let result = Operators.nativeint System.Double.MinValue + if Info.isX86Runtime then + Assert.AreEqual(-2147483648n, result) + else + // Cannot express this as a literal, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual("-9223372036854775808", string result) + + // Max and min value as literals (this breaks compilation if the lexer fails). + // The following tests ensure that the proper value is parsed, which is similar to `nativeint Int64.MaxValue` etc. + if Info.isX86Runtime then + Assert.AreEqual("0", string -9223372036854775808n) // same as int32 -9223372036854775808L + Assert.AreEqual("-1", string 9223372036854775807n) // same as int32 9223372036854775807L + else + Assert.AreEqual("-9223372036854775808", string -9223372036854775808n) + Assert.AreEqual("9223372036854775807", string 9223372036854775807n) + + + [] + let sbyte() = + // int + let result = Operators.sbyte 10 + Assert.AreEqual(10y, result) + + // double + let result = Operators.sbyte 10.0 + Assert.AreEqual(10y, result) + + // negative + let result = Operators.sbyte -10 + Assert.AreEqual(-10y, result) + + // zero + let result = Operators.sbyte 0 + Assert.AreEqual(0y, result) + + // Overflow + let result = Operators.sbyte Int64.MaxValue + Assert.AreEqual(-1y, result) + + // Overflow + let result = Operators.sbyte Int64.MinValue + Assert.AreEqual(0y, result) + + // Overflow + let result = Operators.sbyte Single.MinValue + Assert.AreEqual(0y, result) + + // Overflow + let result = Operators.sbyte Single.MaxValue + Assert.AreEqual(0y, result) + + // Overflow + let result = Operators.sbyte Double.MinValue + Assert.AreEqual(0y, result) + + // Overflow + let result = Operators.sbyte Double.MaxValue + Assert.AreEqual(0y, result) + + // Overflow + let result = Operators.sbyte (Int64.MaxValue * 8L) + Assert.AreEqual(-8y, result) // bit-complement + + // Overflow + let result = 127y + 1y + Assert.AreEqual(-128y, result) + + // OverflowException, from decimal is always checked + CheckThrowsOverflowException(fun () -> Operators.sbyte Decimal.MinValue |> ignore) + + [] + let single() = + // int + let result = Operators.float32 10 + Assert.AreEqual(10f, result) + + // double + let result = Operators.float32 10.0 + Assert.AreEqual(10f, result) + + // string + let result = Operators.float32 "10" + Assert.AreEqual(10f, result) + + + [] + let uint16() = + // int + let result = Operators.uint16 100 + Assert.AreEqual(100us, result) + + // double + let result = Operators.uint16 (100.0:double) + Assert.AreEqual(100us, result) + + // decimal + let result = Operators.uint16 100M + Assert.AreEqual(100us, result) + + // Overflow + let result = Operators.uint16 Single.MaxValue + Assert.AreEqual(0us, result) + + // Overflow + let result = Operators.uint16 Single.MinValue + Assert.AreEqual(0us, result) + + // Overflow + let result = Operators.uint16 Double.MaxValue + Assert.AreEqual(0us, result) + + // Overflow + let result = Operators.uint16 Double.MinValue + Assert.AreEqual(0us, result) + + // OverflowException, from decimal is always checked + CheckThrowsOverflowException(fun () -> Operators.uint16 Decimal.MinValue |> ignore) + + [] + let uint32() = + // int + let result = Operators.uint32 100 + Assert.AreEqual(100u, result) + + // double + let result = Operators.uint32 (100.0:double) + Assert.AreEqual(100u, result) + + // decimal + let result = Operators.uint32 100M + Assert.AreEqual(100u, result) + + // Overflow + let result = Operators.uint32 Single.MaxValue + Assert.AreEqual(0u, result) + + // Overflow + let result = Operators.uint32 Single.MinValue + Assert.AreEqual(0u, result) + + // Overflow + let result = Operators.uint32 Double.MaxValue + Assert.AreEqual(0u, result) + + // Overflow + let result = Operators.uint32 Double.MinValue + Assert.AreEqual(0u, result) + + // Overflow + let result = Operators.uint32 Int64.MaxValue + Assert.AreEqual(UInt32.MaxValue, result) + + // Overflow + let result = Operators.uint32 Int64.MinValue + Assert.AreEqual(0u, result) + + // Overflow + let result = UInt32.MaxValue + 5u + Assert.AreEqual(4u, result) + + // both 'u' and 'ul' are valid numeric suffixes for UInt32 + let result = 42u + 42ul + Assert.AreEqual(84u, result) + Assert.AreEqual(84ul, result) + + // OverflowException, from decimal is always checked + CheckThrowsOverflowException(fun () -> Operators.uint32 Decimal.MinValue |> ignore) + + [] + let uint64() = + // int + let result = Operators.uint64 100 + Assert.AreEqual(100UL, result) + + // double + let result = Operators.uint64 100.0 + Assert.AreEqual(100UL, result) + + // decimal + let result = Operators.uint64 100M + Assert.AreEqual(100UL, result) + + // Overflow + let result = Operators.uint64 Single.MaxValue + Assert.AreEqual(0UL, result) + + // Overflow + let result = Operators.uint64 Single.MinValue + Assert.AreEqual(9223372036854775808UL, result) // surprising, but true, 2^63 + 1 + + // Overflow + let result = Operators.uint64 Double.MaxValue + Assert.AreEqual(0UL, result) + + // Overflow + let result = Operators.uint64 Double.MinValue + Assert.AreEqual(9223372036854775808UL, result) // surprising, but true, 2^63 + 1 + + // Overflow + let result = Operators.uint64 Int64.MinValue + Assert.AreEqual(9223372036854775808UL, result) + + // Overflow + let result = Operators.uint64 SByte.MinValue + Assert.AreEqual(UInt64.MaxValue - 127UL, result) + + // Overflow + let result = UInt64.MaxValue + 5UL + Assert.AreEqual(4UL, result) + + // OverflowException, from decimal is always checked + CheckThrowsOverflowException(fun () -> Operators.uint64 Decimal.MinValue |> ignore) + + [] + let unativeint() = + // int + let result = Operators.unativeint 100 + let x: unativeint = 12un + Assert.AreEqual(100un, result) + + // double + let result = Operators.unativeint 100.0 + Assert.AreEqual(100un, result) + + // Overflow Single.MaxValue is equal on 32 bits and 64 bits runtimes + let result = Operators.unativeint Single.MaxValue + Assert.AreEqual(0un, result) + + // Overflow (depends on pointer size) + let result = Operators.unativeint Single.MinValue + if Info.isX86Runtime then + Assert.AreEqual(0un, result) + else + Assert.AreEqual(9223372036854775808un, result) // surprising, but true, 2^63 + 1 + + // Overflow Double.MaxValue is equal on 32 bits and 64 bits runtimes + let result = Operators.unativeint Double.MaxValue + Assert.AreEqual(0un, result) + + // Overflow (depends on pointer size) + let result = Operators.unativeint Double.MinValue + if Info.isX86Runtime then + Assert.AreEqual(0un, result) + else + Assert.AreEqual(9223372036854775808un, result) // surprising, but true, 2^63 + 1 + + // Overflow (depends on pointer size) + let result = Operators.unativeint Int64.MinValue + if Info.isX86Runtime then + Assert.AreEqual(0un, result) + else + Assert.AreEqual(9223372036854775808un, result) + + // Overflow (depends on pointer size) + let result = 0un - 1un + if Info.isX86Runtime then + Assert.AreEqual(4294967295un, result) + else + Assert.AreEqual(18446744073709551615un, result) + + open Operators.Checked + + [] + let Checkedbyte() = + // int type + let intByte = Operators.Checked.byte 100 + Assert.AreEqual(100uy, intByte) + + // char type + let charByte = Operators.Checked.byte '0' + Assert.AreEqual(48uy, charByte) + + // boundary value + let boundByte = Operators.Checked.byte 255.0 + Assert.AreEqual(255uy, boundByte) + + // overflow exception + CheckThrowsOverflowException(fun () -> Operators.Checked.byte 256 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.byte 256f |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.byte 256. |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> 255uy + 1uy |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> 0uy - 1uy |> ignore) + + [] + let Checkedchar() = + + // number + let numberChar = Operators.Checked.char 48 + Assert.AreEqual('0', numberChar) + + // letter + let letterChar = Operators.Checked.char 65 + Assert.AreEqual('A', letterChar) + + // boundary value + let boundchar = Operators.Checked.char 126 + Assert.AreEqual('~', boundchar) + + // overflow exception + CheckThrowsOverflowException(fun () -> Operators.Checked.char (int64 Char.MaxValue + 1L) |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.char Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.char Double.MaxValue |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> '\uFFFF' + '\u0001' |> ignore) + + + [] + let CheckedInt() = + + // char + let charInt = Operators.Checked.int '0' + Assert.AreEqual(48, charInt) + + // float + let floatInt = Operators.Checked.int 10.0 + Assert.AreEqual(10, floatInt) + + // boundary value + let boundInt = Operators.Checked.int 32767.0 + Assert.AreEqual(32767, boundInt) + + // overflow exception + CheckThrowsOverflowException(fun () -> Operators.Checked.int 2147483648.0 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int Double.MaxValue |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> Int32.MaxValue + 1 |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> Int32.MinValue - 1 |> ignore) + + [] + let CheckedInt16() = + + // char + let charInt16 = Operators.Checked.int16 '0' + Assert.AreEqual(48s, charInt16) + + // float + let floatInt16 = Operators.Checked.int16 10.0 + Assert.AreEqual(10s, floatInt16) + + // boundary value + let boundInt16 = Operators.Checked.int16 32767.0 + Assert.AreEqual(32767s, boundInt16) + + // overflow exception + CheckThrowsOverflowException(fun () -> Operators.Checked.int16 32768.0 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int16 Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int16 Double.MaxValue |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> Int16.MaxValue + 1s |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> Int16.MinValue - 1s |> ignore) + + [] + let CheckedInt32() = + + // char + let charInt32 = Operators.Checked.int32 '0' + Assert.AreEqual(48, charInt32) + + // float + let floatInt32 = Operators.Checked.int32 10.0 + Assert.AreEqual(10, floatInt32) + + // boundary value + let boundInt32 = Operators.Checked.int32 2147483647.0 + Assert.AreEqual(2147483647, boundInt32) + + // overflow exception + CheckThrowsOverflowException(fun () -> Operators.Checked.int32 2147483648.0 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int32 Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int32 Double.MaxValue |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> Int32.MaxValue + 1 |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> Int32.MinValue - 1 |> ignore) + + [] + let CheckedInt64() = + + // char + let charInt64 = Operators.Checked.int64 '0' + Assert.AreEqual(48L, charInt64) + + // float + let floatInt64 = Operators.Checked.int64 10.0 + Assert.AreEqual(10L, floatInt64) + + // boundary value + let boundInt64 = Operators.Checked.int64 9223372036854775807I + let _ = 9223372036854775807L + Assert.AreEqual(9223372036854775807L, boundInt64) + + // boundary value + let boundInt64 = Operators.Checked.int64 -9223372036854775808I + let _ = -9223372036854775808L + Assert.AreEqual(-9223372036854775808L, boundInt64) + + // overflow exception + CheckThrowsOverflowException(fun () -> Operators.Checked.int64 (float Int64.MaxValue + 1.0) |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int64 Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int64 Double.MaxValue |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> Int64.MaxValue + 1L |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> Int64.MinValue - 1L |> ignore) + + [] + let CheckedNativeint() = + + // char + let charnativeint = Operators.Checked.nativeint '0' + Assert.AreEqual(48n, charnativeint) + + // float + let floatnativeint = Operators.Checked.nativeint 10.0 + Assert.AreEqual(10n, floatnativeint) + + // boundary value + let boundnativeint = Operators.Checked.nativeint 32767.0 + Assert.AreEqual(32767n, boundnativeint) + + // overflow exception (depends on pointer size) + CheckThrowsOverflowException(fun () -> + if Info.isX86Runtime then + Operators.Checked.nativeint 2147483648.0 |> ignore + else + Operators.Checked.nativeint 9223372036854775808.0 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.nativeint Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.nativeint Double.MaxValue |> ignore) + + + [] + let Checkedsbyte() = + + // char + let charsbyte = Operators.Checked.sbyte '0' + Assert.AreEqual(48y, charsbyte) + + // float + let floatsbyte = Operators.Checked.sbyte -10.0 + Assert.AreEqual(-10y, floatsbyte) + + // boundary value + let boundsbyte = Operators.Checked.sbyte -127.0 + Assert.AreEqual(-127y, boundsbyte) + + // overflow exception + CheckThrowsOverflowException(fun () -> Operators.Checked.sbyte -256 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.sbyte Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.sbyte Double.MaxValue |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> SByte.MaxValue + 1y |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> SByte.MinValue - 1y |> ignore) + + [] + let Checkeduint16() = + + // char + let charuint16 = Operators.Checked.uint16 '0' + Assert.AreEqual(48us, charuint16) + + // float + let floatuint16 = Operators.Checked.uint16 10.0 + Assert.AreEqual(10us, floatuint16) + + // boundary value + let bounduint16 = Operators.Checked.uint16 65535.0 + Assert.AreEqual(65535us, bounduint16) + + CheckThrowsOverflowException(fun () -> Operators.Checked.uint16 65536.0 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.uint16 Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.uint16 Double.MaxValue |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> UInt16.MaxValue + 1us |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> UInt16.MinValue - 1us |> ignore) + + [] + let Checkeduint32() = + + // char + let charuint32 = Operators.Checked.uint32 '0' + Assert.AreEqual(48u, charuint32) + + // float + let floatuint32 = Operators.Checked.uint32 10.0 + Assert.AreEqual(10u, floatuint32) + + // boundary value + let bounduint32 = Operators.Checked.uint32 429496729.0 + Assert.AreEqual(429496729u, bounduint32) + + // overflow exception + CheckThrowsOverflowException(fun () -> Operators.Checked.uint32 (float UInt32.MaxValue + 1.0) |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.uint32 Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.uint32 Double.MaxValue |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> UInt32.MaxValue + 1u |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> UInt32.MinValue - 1u |> ignore) + + [] + let Checkeduint64() = + + // char + let charuint64 = Operators.Checked.uint64 '0' + Assert.AreEqual(48UL, charuint64) + + // float + let floatuint64 = Operators.Checked.uint64 10.0 + Assert.AreEqual(10UL, floatuint64) + + // boundary value + let bounduint64 = Operators.Checked.uint64 429496729.0 + Assert.AreEqual(429496729UL, bounduint64) + + // overflow exception + CheckThrowsOverflowException(fun () -> Operators.Checked.uint64 (float System.UInt64.MaxValue + 1.0) |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.uint64 Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.uint64 Double.MaxValue |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> UInt64.MaxValue + 1UL |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> UInt64.MinValue - 1UL |> ignore) + + [] + let Checkedunativeint() = + + // char + let charunativeint = Operators.Checked.unativeint '0' + Assert.AreEqual(48un, charunativeint) + + // float + let floatunativeint = Operators.Checked.unativeint 10.0 + Assert.AreEqual(10un, floatunativeint) + + // boundary value (dependent on pointer size) + if Info.isX86Runtime then + let boundunativeint = Operators.Checked.unativeint 4294967295.0 + Assert.AreEqual(4294967295un, boundunativeint) + else + let boundnativeint = Operators.Checked.unativeint 1.84467440737095505E+19 // 64 bit max value cannot be expressed exactly as double + Assert.AreEqual(18446744073709549568un, boundnativeint) + + // overflow exception (depends on pointer size) + CheckThrowsOverflowException(fun () -> + if Info.isX86Runtime then + Operators.Checked.unativeint (float UInt32.MaxValue + 1.0) |> ignore + else + Operators.Checked.unativeint (float UInt64.MaxValue + 1.0) |> ignore + ) + CheckThrowsOverflowException(fun () -> Operators.Checked.unativeint Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.unativeint Double.MaxValue |> ignore) + + type A = A + type B() = + static member op_Equality(_: B, _: B) = false + static member op_Inequality(_: B, _: B) = true + type [] C = + static member op_Equality(_: C, _: C) = true + static member op_Inequality(_: C, _: C) = true + static member op_Explicit(_: A) = C() // Explicit from another type + static member op_Explicit(_: C) = B() // Explicit to another type + static member op_Implicit(_: D) = C() // Duplicated implicit conversion + static member op_Explicit(_: C) = { D = 0 } // Duplicated explicit conversion + and D = { D : int } with + static member op_Implicit(_: A) = { D = 0 } // Implicit from another type + static member op_Implicit(_: D) = B() // Implicit to another type + static member op_Implicit(_: D) = C() // Duplicated implicit conversion + static member op_Explicit(_: C) = { D = 0 } // Duplicated explicit conversion + let [] Equality_ExplicitDynamicTests() = + Assert.False(LanguagePrimitives.EqualityDynamic(B())(B()) : bool) + Assert.True(LanguagePrimitives.InequalityDynamic(B())(B()) : bool) + Assert.True(LanguagePrimitives.EqualityDynamic(C())(C()) : bool) + Assert.True(LanguagePrimitives.InequalityDynamic(C())(C()) : bool) + Assert.NotNull(LanguagePrimitives.ExplicitDynamic(A) : C) + Assert.NotNull(LanguagePrimitives.ExplicitDynamic(A) : C) // Explicit from another type + Assert.NotNull(LanguagePrimitives.ExplicitDynamic(C()) : B) // Explicit to another type + Assert.NotNull(LanguagePrimitives.ExplicitDynamic({ D = 0 }) : C) // Duplicated implicit conversion + Assert.NotNull(LanguagePrimitives.ExplicitDynamic(C()) : D) // Duplicated explicit conversion + Assert.NotNull(LanguagePrimitives.ExplicitDynamic(A) : D) // Implicit from another type + Assert.NotNull(LanguagePrimitives.ExplicitDynamic({ D = 0 }) : B) // Implicit to another type + Assert.NotNull(LanguagePrimitives.ExplicitDynamic({ D = 0 }) : C) // Duplicated implicit conversion + Assert.NotNull(LanguagePrimitives.ExplicitDynamic(C()) : D) // Duplicated explicit conversion \ No newline at end of file diff --git a/tests/FSharp.Core.UnitTests/SurfaceArea.fs b/tests/FSharp.Core.UnitTests/SurfaceArea.fs index 31d2fa41d15..c214e76daf7 100644 --- a/tests/FSharp.Core.UnitTests/SurfaceArea.fs +++ b/tests/FSharp.Core.UnitTests/SurfaceArea.fs @@ -1486,6 +1486,7 @@ Microsoft.FSharp.Core.LanguagePrimitives: TResult AdditionDynamic[T1,T2,TResult] Microsoft.FSharp.Core.LanguagePrimitives: TResult BitwiseAndDynamic[T1,T2,TResult](T1, T2) Microsoft.FSharp.Core.LanguagePrimitives: TResult BitwiseOrDynamic[T1,T2,TResult](T1, T2) Microsoft.FSharp.Core.LanguagePrimitives: TResult CheckedAdditionDynamic[T1,T2,TResult](T1, T2) +Microsoft.FSharp.Core.LanguagePrimitives: TResult CheckedExplicitDynamic[T,TResult](T) Microsoft.FSharp.Core.LanguagePrimitives: TResult CheckedMultiplyDynamic[T1,T2,TResult](T1, T2) Microsoft.FSharp.Core.LanguagePrimitives: TResult CheckedSubtractionDynamic[T1,T2,TResult](T1, T2) Microsoft.FSharp.Core.LanguagePrimitives: TResult CheckedUnaryNegationDynamic[T,TResult](T) diff --git a/tests/FSharp.Test.Utilities/TestFramework.fs b/tests/FSharp.Test.Utilities/TestFramework.fs index f2d93c0513c..60aac52400a 100644 --- a/tests/FSharp.Test.Utilities/TestFramework.fs +++ b/tests/FSharp.Test.Utilities/TestFramework.fs @@ -652,8 +652,8 @@ let diff normalize path1 path2 = if x >= 0 then line.Substring(x+cwd.Length) else line else line - let line1 = normalizePath lines1[i] - let line2 = normalizePath lines2[i] + let line1 = lines1[i] |> normalizePath + let line2 = lines2[i] |> normalizePath if line1 <> line2 then append <| sprintf "diff between [%s] and [%s]" path1 path2 diff --git a/tests/fsharp/core/libtest/test.fsx b/tests/fsharp/core/libtest/test.fsx index bf58ea27d08..a2cdb2fd60f 100644 --- a/tests/fsharp/core/libtest/test.fsx +++ b/tests/fsharp/core/libtest/test.fsx @@ -3657,6 +3657,46 @@ module Optimiations = begin let _ = check "opt.oi20c77tb" (0x8000000000000000L >>> 63) (0xFFFFFFFFFFFFFFFFL) let _ = check "opt.oi20c77yb" (0x8000000000000000L >>> 64) (0x8000000000000000L) + let _ = check "opt.oi20c77qc" ('a' + '\025') ('z') + let _ = check "opt.oi20c77wc" ('z' - '\025') ('a') + let _ = check "opt.oi20c77ec" (nativeint -3m) (-3n) + let _ = check "opt.oi20c77rc" (nativeint 3m) (3n) + let _ = check "opt.oi20c77tc" (unativeint 3m) (3un) + let _ = check "opt.oi20c77yc" (char 65535m) ('\uFFFF') + let _ = check "opt.oi20c77uc" (decimal '\uFFFF') (65535m) + let _ = check "opt.oi20c77ic" (nativeint "3") (3n) + let _ = check "opt.oi20c77oc" (nativeint "-3") (-3n) + let _ = check "opt.oi20c77pc" (unativeint "3") (3un) + let _ = check "opt.oi20c77ac" (Checked.(+) 'a' '\025') ('z') + let _ = check "opt.oi20c77sc" (Checked.(-) 'z' '\025') ('a') + let _ = check "opt.oi20c77dc" (Checked.nativeint -3m) (-3n) + let _ = check "opt.oi20c77fc" (Checked.nativeint 3m) (3n) + let _ = check "opt.oi20c77gc" (Checked.unativeint 3m) (3un) + let _ = check "opt.oi20c77hc" (Checked.char 65535m) ('\uFFFF') + let _ = check "opt.oi20c77jc" (Checked.nativeint "3") (3n) + let _ = check "opt.oi20c77kc" (Checked.nativeint "-3") (-3n) + let _ = check "opt.oi20c77lc" (Checked.unativeint "3") (3un) + let _ = check "opt.oi20c77zc" (int8 3.9m) (3y) + let _ = check "opt.oi20c77xc" (uint8 3.9m) (3uy) + let _ = check "opt.oi20c77cc" (int16 3.9m) (3s) + let _ = check "opt.oi20c77vc" (uint16 3.9m) (3us) + let _ = check "opt.oi20c77bc" (int32 3.9m) (3l) + let _ = check "opt.oi20c77nc" (uint32 3.9m) (3ul) + let _ = check "opt.oi20c77mc" (int64 3.9m) (3L) + let _ = check "opt.oi20c77,c" (uint64 3.9m) (3uL) + let _ = check "opt.oi20c77.c" (nativeint 3.9m) (3n) + let _ = check "opt.oi20c77/c" (unativeint 3.9m) (3un) + let _ = check "opt.oi20c77zc'" (Checked.int8 3.9m) (3y) + let _ = check "opt.oi20c77xc'" (Checked.uint8 3.9m) (3uy) + let _ = check "opt.oi20c77cc'" (Checked.int16 3.9m) (3s) + let _ = check "opt.oi20c77vc'" (Checked.uint16 3.9m) (3us) + let _ = check "opt.oi20c77bc'" (Checked.int32 3.9m) (3l) + let _ = check "opt.oi20c77nc'" (Checked.uint32 3.9m) (3ul) + let _ = check "opt.oi20c77mc'" (Checked.int64 3.9m) (3L) + let _ = check "opt.oi20c77,c'" (Checked.uint64 3.9m) (3uL) + let _ = check "opt.oi20c77.c'" (Checked.nativeint 3.9m) (3n) + let _ = check "opt.oi20c77/c'" (Checked.unativeint 3.9m) (3un) + end diff --git a/tests/fsharp/core/printing/output.1000.stdout.bsl b/tests/fsharp/core/printing/output.1000.stdout.bsl index cc3eaef035e..cdf91519c8d 100644 --- a/tests/fsharp/core/printing/output.1000.stdout.bsl +++ b/tests/fsharp/core/printing/output.1000.stdout.bsl @@ -2764,4 +2764,57 @@ val ShortName: string = "hi" > val list2: int list = [1] +module FSI_0317. + D27805741a339047ef3ed7a2ca8faae3c17e6ef2371984011e49a6c9c3286641 + +{"ImmutableField0":6} +type R1 = + { ImmutableField0: int } +val it: unit = () + +> val it: R1 = { ImmutableField0 = 7 } + +> {"MutableField1":8} +type R2 = + { mutable MutableField1: int } +val it: unit = () + +> val it: R2 = { MutableField1 = 9 } + +> {"AnonRecordField2":10} +val it: unit = () + +> val it: {| AnonRecordField2: int |} = { AnonRecordField2 = 11 } + +module FSI_0324.Project.fsproj + +type R3 = + { ImmutableField3: int } +val test3a: string = "{"ImmutableField3":12}" + +> val test3b: R3 = { ImmutableField3 = 12 } + +> val test3c: string = "{"ImmutableField3":13}" + +> val test3d: R3 = { ImmutableField3 = 13 } + +> type R4 = + { mutable MutableField4: int } +val test4a: string = "{"MutableField4":15}" + +> val test4b: R4 = { MutableField4 = 15 } + +> val test4c: string = "{"MutableField4":16}" + +> val test4d: R4 = { MutableField4 = 16 } + +> type R5 = {| AnonRecordField5: int |} +val test5a: string = "{"AnonRecordField5":17}" + +> val test5b: R5 = { AnonRecordField5 = 17 } + +> val test5c: string = "{"AnonRecordField5":18}" + +> val test5d: R5 = { AnonRecordField5 = 18 } + > > > diff --git a/tests/fsharp/core/printing/output.200.stdout.bsl b/tests/fsharp/core/printing/output.200.stdout.bsl index 6d1b4c6dfc9..cb22322c94a 100644 --- a/tests/fsharp/core/printing/output.200.stdout.bsl +++ b/tests/fsharp/core/printing/output.200.stdout.bsl @@ -2009,4 +2009,57 @@ val ShortName: string = "hi" > val list2: int list = [1] +module FSI_0317. + D27805741a339047ef3ed7a2ca8faae3c17e6ef2371984011e49a6c9c3286641 + +{"ImmutableField0":6} +type R1 = + { ImmutableField0: int } +val it: unit = () + +> val it: R1 = { ImmutableField0 = 7 } + +> {"MutableField1":8} +type R2 = + { mutable MutableField1: int } +val it: unit = () + +> val it: R2 = { MutableField1 = 9 } + +> {"AnonRecordField2":10} +val it: unit = () + +> val it: {| AnonRecordField2: int |} = { AnonRecordField2 = 11 } + +module FSI_0324.Project.fsproj + +type R3 = + { ImmutableField3: int } +val test3a: string = "{"ImmutableField3":12}" + +> val test3b: R3 = { ImmutableField3 = 12 } + +> val test3c: string = "{"ImmutableField3":13}" + +> val test3d: R3 = { ImmutableField3 = 13 } + +> type R4 = + { mutable MutableField4: int } +val test4a: string = "{"MutableField4":15}" + +> val test4b: R4 = { MutableField4 = 15 } + +> val test4c: string = "{"MutableField4":16}" + +> val test4d: R4 = { MutableField4 = 16 } + +> type R5 = {| AnonRecordField5: int |} +val test5a: string = "{"AnonRecordField5":17}" + +> val test5b: R5 = { AnonRecordField5 = 17 } + +> val test5c: string = "{"AnonRecordField5":18}" + +> val test5d: R5 = { AnonRecordField5 = 18 } + > > > diff --git a/tests/fsharp/core/printing/output.47.stderr.bsl b/tests/fsharp/core/printing/output.47.stderr.bsl index 4d3209ca246..3e98bca2fc4 100644 --- a/tests/fsharp/core/printing/output.47.stderr.bsl +++ b/tests/fsharp/core/printing/output.47.stderr.bsl @@ -334,3 +334,111 @@ stdin(838,6): error FS1210: Active pattern '|A|B|' has a result type containing stdin(844,6): error FS1209: Active pattern '|A|B|' is not a function + + #r "nuget:Newtonsoft.Json, 13.0.1" + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +stdin(1117,1): error FS3302: The 'package management' feature requires language version 5.0 or above + + + JsonConvert.SerializeObject { ImmutableField0 = 7 } + ^^^^^^^^^^^ + +stdin(1122,1): error FS0039: The value, namespace, type or module 'JsonConvert' is not defined. + + + JsonConvert.SerializeObject { MutableField1 = 8 } |> printfn "%s";; + ^^^^^^^^^^^ + +stdin(1126,1): error FS0039: The value, namespace, type or module 'JsonConvert' is not defined. + + + JsonConvert.SerializeObject { MutableField1 = 9 } + ^^^^^^^^^^^ + +stdin(1128,1): error FS0039: The value, namespace, type or module 'JsonConvert' is not defined. + + + JsonConvert.SerializeObject {| AnonRecordField2 = 10 |} |> printfn "%s";; + ^^^^^^^^^^^ + +stdin(1131,1): error FS0039: The value, namespace, type or module 'JsonConvert' is not defined. + + + JsonConvert.SerializeObject {| AnonRecordField2 = 11 |} + ^^^^^^^^^^^ + +stdin(1133,1): error FS0039: The value, namespace, type or module 'JsonConvert' is not defined. + + + #r "nuget: System.Text.Json" + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +stdin(1136,1): error FS3302: The 'package management' feature requires language version 5.0 or above + + + let test3b = JsonSerializer.Deserialize test3a;; + -------------^^^^^^^^^^^^^^ + +stdin(1140,14): error FS0039: The value, namespace, type or module 'JsonSerializer' is not defined. + + + let test3c = JsonSerializer.Serialize { ImmutableField3 = 13 };; + -------------^^^^^^^^^^^^^^ + +stdin(1141,14): error FS0039: The value, namespace, type or module 'JsonSerializer' is not defined. + + + let test3d = JsonSerializer.Deserialize test3c;; + -------------^^^^^^^^^^^^^^ + +stdin(1142,14): error FS0039: The value, namespace, type or module 'JsonSerializer' is not defined. + + + let test4a = JsonSerializer.Serialize { MutableField4 = 15 };; + -------------^^^^^^^^^^^^^^ + +stdin(1145,14): error FS0039: The value, namespace, type or module 'JsonSerializer' is not defined. + + + let test4b = JsonSerializer.Deserialize test4a;; + -------------^^^^^^^^^^^^^^ + +stdin(1146,14): error FS0039: The value, namespace, type or module 'JsonSerializer' is not defined. + + + let test4c = JsonSerializer.Serialize { MutableField4 = 16 };; + -------------^^^^^^^^^^^^^^ + +stdin(1147,14): error FS0039: The value, namespace, type or module 'JsonSerializer' is not defined. + + + let test4d = JsonSerializer.Deserialize test4c;; + -------------^^^^^^^^^^^^^^ + +stdin(1148,14): error FS0039: The value, namespace, type or module 'JsonSerializer' is not defined. + + + let test5a = JsonSerializer.Serialize {| AnonRecordField5 = 17 |};; + -------------^^^^^^^^^^^^^^ + +stdin(1151,14): error FS0039: The value, namespace, type or module 'JsonSerializer' is not defined. + + + let test5b = JsonSerializer.Deserialize test5a;; + -------------^^^^^^^^^^^^^^ + +stdin(1152,14): error FS0039: The value, namespace, type or module 'JsonSerializer' is not defined. + + + let test5c = JsonSerializer.Serialize {| AnonRecordField5 = 18 |};; + -------------^^^^^^^^^^^^^^ + +stdin(1153,14): error FS0039: The value, namespace, type or module 'JsonSerializer' is not defined. + + + let test5d = JsonSerializer.Deserialize test5c;; + -------------^^^^^^^^^^^^^^ + +stdin(1154,14): error FS0039: The value, namespace, type or module 'JsonSerializer' is not defined. + diff --git a/tests/fsharp/core/printing/output.47.stdout.bsl b/tests/fsharp/core/printing/output.47.stdout.bsl index af2d597eaad..b6f38074b36 100644 --- a/tests/fsharp/core/printing/output.47.stdout.bsl +++ b/tests/fsharp/core/printing/output.47.stdout.bsl @@ -6309,4 +6309,4 @@ val ShortName: string = "hi" > val list2: int list = [1] -> > > +> > > > > > > > > > > > > > > > > > > > > diff --git a/tests/fsharp/core/printing/output.multiemit.stdout.bsl b/tests/fsharp/core/printing/output.multiemit.stdout.bsl index acdcf6c63d8..9183285f872 100644 --- a/tests/fsharp/core/printing/output.multiemit.stdout.bsl +++ b/tests/fsharp/core/printing/output.multiemit.stdout.bsl @@ -6311,4 +6311,57 @@ val ShortName: string = "hi" > val list2: int list = [1] +module FSI_0316. + D27805741a339047ef3ed7a2ca8faae3c17e6ef2371984011e49a6c9c3286641 + +{"ImmutableField0":6} +type R1 = + { ImmutableField0: int } +val it: unit = () + +> val it: R1 = { ImmutableField0 = 7 } + +> {"MutableField1":8} +type R2 = + { mutable MutableField1: int } +val it: unit = () + +> val it: R2 = { MutableField1 = 9 } + +> {"AnonRecordField2":10} +val it: unit = () + +> val it: {| AnonRecordField2: int |} = { AnonRecordField2 = 11 } + +module FSI_0323.Project.fsproj + +type R3 = + { ImmutableField3: int } +val test3a: string = "{"ImmutableField3":12}" + +> val test3b: R3 = { ImmutableField3 = 12 } + +> val test3c: string = "{"ImmutableField3":13}" + +> val test3d: R3 = { ImmutableField3 = 13 } + +> type R4 = + { mutable MutableField4: int } +val test4a: string = "{"MutableField4":15}" + +> val test4b: R4 = { MutableField4 = 15 } + +> val test4c: string = "{"MutableField4":16}" + +> val test4d: R4 = { MutableField4 = 16 } + +> type R5 = {| AnonRecordField5: int |} +val test5a: string = "{"AnonRecordField5":17}" + +> val test5b: R5 = { AnonRecordField5 = 17 } + +> val test5c: string = "{"AnonRecordField5":18}" + +> val test5d: R5 = { AnonRecordField5 = 18 } + > > > diff --git a/tests/fsharp/core/printing/output.off.stdout.bsl b/tests/fsharp/core/printing/output.off.stdout.bsl index 2bd43f77f8f..586d7a58860 100644 --- a/tests/fsharp/core/printing/output.off.stdout.bsl +++ b/tests/fsharp/core/printing/output.off.stdout.bsl @@ -1778,4 +1778,57 @@ val ShortName: string = "hi" > val list2: int list +module FSI_0317. + D27805741a339047ef3ed7a2ca8faae3c17e6ef2371984011e49a6c9c3286641 + +{"ImmutableField0":6} +type R1 = + { ImmutableField0: int } +val it: unit + +> val it: R1 = { ImmutableField0 = 7 } + +> {"MutableField1":8} +type R2 = + { mutable MutableField1: int } +val it: unit + +> val it: R2 = { MutableField1 = 9 } + +> {"AnonRecordField2":10} +val it: unit = () + +> val it: {| AnonRecordField2: int |} = { AnonRecordField2 = 11 } + +module FSI_0324.Project.fsproj + +type R3 = + { ImmutableField3: int } +val test3a: string + +> val test3b: R3 + +> val test3c: string + +> val test3d: R3 + +> type R4 = + { mutable MutableField4: int } +val test4a: string + +> val test4b: R4 + +> val test4c: string + +> val test4d: R4 + +> type R5 = {| AnonRecordField5: int |} +val test5a: string + +> val test5b: R5 + +> val test5c: string + +> val test5d: R5 + > > > diff --git a/tests/fsharp/core/printing/output.quiet.stdout.bsl b/tests/fsharp/core/printing/output.quiet.stdout.bsl index 26683b52103..d8d778aca70 100644 --- a/tests/fsharp/core/printing/output.quiet.stdout.bsl +++ b/tests/fsharp/core/printing/output.quiet.stdout.bsl @@ -11,3 +11,6 @@ [Building 5 3...done] Expect ABC = ABC Expect ABC = ABC +{"ImmutableField0":6} +{"MutableField1":8} +{"AnonRecordField2":10} diff --git a/tests/fsharp/core/printing/output.stdout.bsl b/tests/fsharp/core/printing/output.stdout.bsl index acdcf6c63d8..9183285f872 100644 --- a/tests/fsharp/core/printing/output.stdout.bsl +++ b/tests/fsharp/core/printing/output.stdout.bsl @@ -6311,4 +6311,57 @@ val ShortName: string = "hi" > val list2: int list = [1] +module FSI_0316. + D27805741a339047ef3ed7a2ca8faae3c17e6ef2371984011e49a6c9c3286641 + +{"ImmutableField0":6} +type R1 = + { ImmutableField0: int } +val it: unit = () + +> val it: R1 = { ImmutableField0 = 7 } + +> {"MutableField1":8} +type R2 = + { mutable MutableField1: int } +val it: unit = () + +> val it: R2 = { MutableField1 = 9 } + +> {"AnonRecordField2":10} +val it: unit = () + +> val it: {| AnonRecordField2: int |} = { AnonRecordField2 = 11 } + +module FSI_0323.Project.fsproj + +type R3 = + { ImmutableField3: int } +val test3a: string = "{"ImmutableField3":12}" + +> val test3b: R3 = { ImmutableField3 = 12 } + +> val test3c: string = "{"ImmutableField3":13}" + +> val test3d: R3 = { ImmutableField3 = 13 } + +> type R4 = + { mutable MutableField4: int } +val test4a: string = "{"MutableField4":15}" + +> val test4b: R4 = { MutableField4 = 15 } + +> val test4c: string = "{"MutableField4":16}" + +> val test4d: R4 = { MutableField4 = 16 } + +> type R5 = {| AnonRecordField5: int |} +val test5a: string = "{"AnonRecordField5":17}" + +> val test5b: R5 = { AnonRecordField5 = 17 } + +> val test5c: string = "{"AnonRecordField5":18}" + +> val test5d: R5 = { AnonRecordField5 = 18 } + > > > diff --git a/tests/fsharp/core/printing/test.fsx b/tests/fsharp/core/printing/test.fsx index 1bd15e348f8..c0943540b49 100644 --- a/tests/fsharp/core/printing/test.fsx +++ b/tests/fsharp/core/printing/test.fsx @@ -1114,6 +1114,46 @@ let list = [{ A = 1; B = "a" }];; let list2 = [ for x in list do x.A ];; +#r "nuget:Newtonsoft.Json, 13.0.1" +type R1 = { ImmutableField0: int } +open Newtonsoft.Json +JsonConvert.SerializeObject { ImmutableField0 = 6 } |> printfn "%s";; + +JsonConvert.SerializeObject { ImmutableField0 = 7 } +|> JsonConvert.DeserializeObject;; + +type R2 = { mutable MutableField1: int } +JsonConvert.SerializeObject { MutableField1 = 8 } |> printfn "%s";; + +JsonConvert.SerializeObject { MutableField1 = 9 } +|> JsonConvert.DeserializeObject;; + +JsonConvert.SerializeObject {| AnonRecordField2 = 10 |} |> printfn "%s";; + +JsonConvert.SerializeObject {| AnonRecordField2 = 11 |} +|> JsonConvert.DeserializeObject<{| AnonRecordField2 :int |}>;; + +#r "nuget: System.Text.Json" +open System.Text.Json +type R3 = { ImmutableField3: int } +let test3a = JsonSerializer.Serialize { ImmutableField3 = 12 };; +let test3b = JsonSerializer.Deserialize test3a;; +let test3c = JsonSerializer.Serialize { ImmutableField3 = 13 };; +let test3d = JsonSerializer.Deserialize test3c;; + +type R4 = { mutable MutableField4: int } +let test4a = JsonSerializer.Serialize { MutableField4 = 15 };; +let test4b = JsonSerializer.Deserialize test4a;; +let test4c = JsonSerializer.Serialize { MutableField4 = 16 };; +let test4d = JsonSerializer.Deserialize test4c;; + +type R5 = {| AnonRecordField5: int |} +let test5a = JsonSerializer.Serialize {| AnonRecordField5 = 17 |};; +let test5b = JsonSerializer.Deserialize test5a;; +let test5c = JsonSerializer.Serialize {| AnonRecordField5 = 18 |};; +let test5d = JsonSerializer.Deserialize test5c;; + + ;; (* ;; needed, to isolate error regressions *) ;;exit 0;; (* piped in to enable error regressions *) \ No newline at end of file diff --git a/tests/fsharp/core/quotes/test.fsx b/tests/fsharp/core/quotes/test.fsx index e394597f052..cc85cf23ad6 100644 --- a/tests/fsharp/core/quotes/test.fsx +++ b/tests/fsharp/core/quotes/test.fsx @@ -1543,7 +1543,7 @@ module MoreQuotationsTests = [Coerce (enumerator, Object)])), Dispose, []), Value ()))))""" - let t9() = <@@ try failwith "test" with Failure _ -> 0 @@> + let t9() = <@@ try failwith "test" with Failure _ -> 0 @@> checkStrings "vwewvwewe9" (sprintf "%A" (t9())) """TryWith (Call (None, FailWith, [Value ("test")]), matchValue, Let (activePatternResult1557, Call (None, FailurePattern, [matchValue]), @@ -3257,9 +3257,11 @@ module TestMatchBang = module WitnessTests = open FSharp.Data.UnitSystems.SI.UnitSymbols + open FSharp.Linq + open FSharp.Linq.NullableOperators test "check CallWithWitness" - (<@ 1 + 1 @> + (<@ 1 + 1 @> |> function | CallWithWitnesses(None, minfo1, minfo2, witnessArgs, args) -> minfo1.Name = "op_Addition" && @@ -3380,287 +3382,2045 @@ module WitnessTests = false | _ -> false) - test "check CallWithWitnesses all operators)" + test "check CallWithWitnesses all operators" (let tests = - [ <@@ sin 1.0 @@>, true - <@@ sin 1.0f @@>, true - <@@ sign 1.0f @@>, true - <@@ sqrt 1.0f @@>, true - <@@ 2.0f ** 2.0f @@>, true - <@@ atan2 3.0 4.0 @@>, true - <@@ 1.0f + 4.0f @@>, true - <@@ 1.0f - 4.0f @@>, true - <@@ 1.0f * 4.0f @@>, true - <@@ 1.0M * 4.0M @@>, true - <@@ 1.0f / 4.0f @@>, true - <@@ 1 % 4 @@>, true - <@@ -(4.0M) @@>, true - - <@@ 1y <<< 3 @@>, true - <@@ 1uy <<< 3 @@>, true - <@@ 1s <<< 3 @@>, true - <@@ 1us <<< 3 @@>, true - <@@ 1 <<< 3 @@>, true - <@@ 1u <<< 3 @@>, true - <@@ 1L <<< 3 @@>, true - <@@ 1UL <<< 3 @@>, true - <@@ LanguagePrimitives.GenericOne <<< 3 @@>, false - <@@ LanguagePrimitives.GenericOne <<< 3 @@>, false - - <@@ 1y >>> 3 @@>, true - <@@ 1uy >>> 3 @@>, true - <@@ 1s >>> 3 @@>, true - <@@ 1us >>> 3 @@>, true - <@@ 1 >>> 3 @@>, true - <@@ 1u >>> 3 @@>, true - <@@ 1L >>> 3 @@>, true - <@@ 1UL >>> 3 @@>, true - <@@ LanguagePrimitives.GenericOne >>> 3 @@>, false - <@@ LanguagePrimitives.GenericOne >>> 3 @@>, false + [|<@@ sin 1.0 @@>, box 0x3FEAED548F090CEELF // Around 0.841470984807897 + <@@ sin 1.0f @@>, box 0x3F576AA4lf // = 0.841471f + <@@ sign 1.0f @@>, box 1 + <@@ sqrt 1.0f @@>, box 1f + <@@ atan2 3.0 4.0 @@>, box 0x3FE4978FA3269EE1LF // Around 0.643501108793284 + <@@ atan2 3.0 4.0 @@>, box 0x3FE4978FA3269EE1LF // Around 0.643501108793284 - <@@ 1y &&& 3y @@>, true - <@@ 1uy &&& 3uy @@>, true - <@@ 1s &&& 3s @@>, true - <@@ 1us &&& 3us @@>, true - <@@ 1 &&& 3 @@>, true - <@@ 1u &&& 3u @@>, true - <@@ 1L &&& 3L @@>, true - <@@ 1UL &&& 3UL @@>, true - <@@ LanguagePrimitives.GenericOne &&& LanguagePrimitives.GenericOne @@>, false - <@@ LanguagePrimitives.GenericOne &&& LanguagePrimitives.GenericOne @@>, false - - <@@ 1y ||| 3y @@>, true - <@@ 1uy ||| 3uy @@>, true - <@@ 1s ||| 3s @@>, true - <@@ 1us ||| 3us @@>, true - <@@ 1 ||| 3 @@>, true - <@@ 1u ||| 3u @@>, true - <@@ 1L ||| 3L @@>, true - <@@ 1UL ||| 3UL @@>, true - <@@ LanguagePrimitives.GenericOne ||| LanguagePrimitives.GenericOne @@>, false - <@@ LanguagePrimitives.GenericOne ||| LanguagePrimitives.GenericOne @@>, false - - <@@ 1y ^^^ 3y @@>, true - <@@ 1uy ^^^ 3uy @@>, true - <@@ 1s ^^^ 3s @@>, true - <@@ 1us ^^^ 3us @@>, true - <@@ 1 ^^^ 3 @@>, true - <@@ 1u ^^^ 3u @@>, true - <@@ 1L ^^^ 3L @@>, true - <@@ 1UL ^^^ 3UL @@>, true - <@@ LanguagePrimitives.GenericOne ^^^ LanguagePrimitives.GenericOne @@>, false - <@@ LanguagePrimitives.GenericOne ^^^ LanguagePrimitives.GenericOne @@>, false - - <@@ ~~~3y @@>, true - <@@ ~~~3uy @@>, true - <@@ ~~~3s @@>, true - <@@ ~~~3us @@>, true - <@@ ~~~3 @@>, true - <@@ ~~~3u @@>, true - <@@ ~~~3L @@>, true - <@@ ~~~3UL @@>, true - <@@ ~~~LanguagePrimitives.GenericOne @@>, false - <@@ ~~~LanguagePrimitives.GenericOne @@>, false - - <@@ byte 3uy @@>, true - <@@ byte 3y @@>, true - <@@ byte 3s @@>, true - <@@ byte 3us @@>, true - <@@ byte 3 @@>, true - <@@ byte 3u @@>, true - <@@ byte 3L @@>, true - <@@ byte 3UL @@>, true - <@@ byte 3.0f @@>, true - <@@ byte 3.0 @@>, true - <@@ byte LanguagePrimitives.GenericOne @@>, false - <@@ byte LanguagePrimitives.GenericOne @@>, false - <@@ byte 3.0M @@>, true - <@@ byte "3" @@>, false - - <@@ sbyte 3uy @@>, true - <@@ sbyte 3y @@>, true - <@@ sbyte 3s @@>, true - <@@ sbyte 3us @@>, true - <@@ sbyte 3 @@>, true - <@@ sbyte 3u @@>, true - <@@ sbyte 3L @@>, true - <@@ sbyte 3UL @@>, true - <@@ sbyte 3.0f @@>, true - <@@ sbyte 3.0 @@>, true - <@@ sbyte LanguagePrimitives.GenericOne @@>, false - <@@ sbyte LanguagePrimitives.GenericOne @@>, false - <@@ sbyte 3.0M @@>, true - <@@ sbyte "3" @@>, false - - <@@ int16 3uy @@>, true - <@@ int16 3y @@>, true - <@@ int16 3s @@>, true - <@@ int16 3us @@>, true - <@@ int16 3 @@>, true - <@@ int16 3u @@>, true - <@@ int16 3L @@>, true - <@@ int16 3UL @@>, true - <@@ int16 3.0f @@>, true - <@@ int16 3.0 @@>, true - <@@ int16 LanguagePrimitives.GenericOne @@>, false - <@@ int16 LanguagePrimitives.GenericOne @@>, false - <@@ int16 3.0M @@>, true - <@@ int16 "3" @@>, false - - <@@ uint16 3uy @@>, true - <@@ uint16 3y @@>, true - <@@ uint16 3s @@>, true - <@@ uint16 3us @@>, true - <@@ uint16 3 @@>, true - <@@ uint16 3u @@>, true - <@@ uint16 3L @@>, true - <@@ uint16 3UL @@>, true - <@@ uint16 3.0f @@>, true - <@@ uint16 3.0 @@>, true - <@@ uint16 LanguagePrimitives.GenericOne @@>, false - <@@ uint16 LanguagePrimitives.GenericOne @@>, false - <@@ uint16 3.0M @@>, true - <@@ uint16 "3" @@>, false - - <@@ int32 3uy @@>, true - <@@ int32 3y @@>, true - <@@ int32 3s @@>, true - <@@ int32 3us @@>, true - <@@ int32 3 @@>, true - <@@ int32 3u @@>, true - <@@ int32 3L @@>, true - <@@ int32 3UL @@>, true - <@@ int32 3.0f @@>, true - <@@ int32 3.0 @@>, true - <@@ int32 LanguagePrimitives.GenericOne @@>, false - <@@ int32 LanguagePrimitives.GenericOne @@>, false - <@@ int32 3.0M @@>, true - <@@ int32 "3" @@>, false - - <@@ uint32 3uy @@>, true - <@@ uint32 3y @@>, true - <@@ uint32 3s @@>, true - <@@ uint32 3us @@>, true - <@@ uint32 3 @@>, true - <@@ uint32 3u @@>, true - <@@ uint32 3L @@>, true - <@@ uint32 3UL @@>, true - <@@ uint32 3.0f @@>, true - <@@ uint32 3.0 @@>, true - <@@ uint32 LanguagePrimitives.GenericOne @@>, false - <@@ uint32 LanguagePrimitives.GenericOne @@>, false - <@@ uint32 3.0M @@>, true - <@@ uint32 "3" @@>, false - - <@@ int64 3uy @@>, true - <@@ int64 3y @@>, true - <@@ int64 3s @@>, true - <@@ int64 3us @@>, true - <@@ int64 3 @@>, true - <@@ int64 3u @@>, true - <@@ int64 3L @@>, true - <@@ int64 3UL @@>, true - <@@ int64 3.0f @@>, true - <@@ int64 3.0 @@>, true - <@@ int64 LanguagePrimitives.GenericOne @@>, false - <@@ int64 LanguagePrimitives.GenericOne @@>, false - <@@ int64 3.0M @@>, true - <@@ int64 "3" @@>, false + <@@ 1y + 4y @@>, box 5y + <@@ 1uy + 4uy @@>, box 5uy + <@@ 1s + 4s @@>, box 5s + <@@ 1us + 4us @@>, box 5us + <@@ 1 + 4 @@>, box 5 + <@@ 1u + 4u @@>, box 5u + <@@ 1L + 4L @@>, box 5L + <@@ 1uL + 4uL @@>, box 5uL + <@@ 1.0f + 4.0f @@>, box 5f + <@@ 1.0 + 4.0 @@>, box 5. + <@@ 1m + 4m @@>, box 5m + <@@ 1m + 4m @@>, box 5m + <@@ 1I + 4I @@>, box 5I + <@@ '1' + '\004' @@>, box '5' + <@@ "abc" + "def" @@>, box "abcdef" + <@@ LanguagePrimitives.GenericOne + LanguagePrimitives.GenericOne @@>, box 2n + <@@ LanguagePrimitives.GenericOne + LanguagePrimitives.GenericOne @@>, box 2un + <@@ Checked.(+) 1y 4y @@>, box 5y + <@@ Checked.(+) 1uy 4uy @@>, box 5uy + <@@ Checked.(+) 1s 4s @@>, box 5s + <@@ Checked.(+) 1us 4us @@>, box 5us + <@@ Checked.(+) 1 4 @@>, box 5 + <@@ Checked.(+) 1u 4u @@>, box 5u + <@@ Checked.(+) 1L 4L @@>, box 5L + <@@ Checked.(+) 1uL 4uL @@>, box 5uL + <@@ Checked.(+) 1.0f 4.0f @@>, box 5f + <@@ Checked.(+) 1.0 4.0 @@>, box 5. + <@@ Checked.(+) 1m 4m @@>, box 5m + <@@ Checked.(+) 1m 4m @@>, box 5m + <@@ Checked.(+) 1I 4I @@>, box 5I + <@@ Checked.(+) '1' '\004' @@>, box '5' + <@@ Checked.(+) "abc" "def" @@>, box "abcdef" + <@@ Checked.(+) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box 2n + <@@ Checked.(+) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box 2un + + <@@ 4y - 1y @@>, box 3y + <@@ 4uy - 1uy @@>, box 3uy + <@@ 4s - 1s @@>, box 3s + <@@ 4us - 1us @@>, box 3us + <@@ 4 - 1 @@>, box 3 + <@@ 4u - 1u @@>, box 3u + <@@ 4L - 1L @@>, box 3L + <@@ 4uL - 1uL @@>, box 3uL + <@@ 4.0f - 1.0f @@>, box 3f + <@@ 4.0 - 1.0 @@>, box 3. + <@@ 4m - 1m @@>, box 3m + <@@ 4m - 1m @@>, box 3m + <@@ 4I - 1I @@>, box 3I + <@@ '4' - '\001' @@>, box '3' + <@@ LanguagePrimitives.GenericOne - LanguagePrimitives.GenericOne @@>, box 0n + <@@ LanguagePrimitives.GenericOne - LanguagePrimitives.GenericOne @@>, box 0un + <@@ Checked.(-) 4y 1y @@>, box 3y + <@@ Checked.(-) 4uy 1uy @@>, box 3uy + <@@ Checked.(-) 4s 1s @@>, box 3s + <@@ Checked.(-) 4us 1us @@>, box 3us + <@@ Checked.(-) 4 1 @@>, box 3 + <@@ Checked.(-) 4u 1u @@>, box 3u + <@@ Checked.(-) 4L 1L @@>, box 3L + <@@ Checked.(-) 4uL 1uL @@>, box 3uL + <@@ Checked.(-) 4.0f 1.0f @@>, box 3f + <@@ Checked.(-) 4.0 1.0 @@>, box 3. + <@@ Checked.(-) 4m 1m @@>, box 3m + <@@ Checked.(-) 4m 1m @@>, box 3m + <@@ Checked.(-) 4I 1I @@>, box 3I + <@@ Checked.(-) '4' '\001' @@>, box '3' + <@@ Checked.(-) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box 0n + <@@ Checked.(-) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box 0un + + <@@ 2y * 4y @@>, box 8y + <@@ 2uy * 4uy @@>, box 8uy + <@@ 2s * 4s @@>, box 8s + <@@ 2us * 4us @@>, box 8us + <@@ 2 * 4 @@>, box 8 + <@@ 2u * 4u @@>, box 8u + <@@ 2L * 4L @@>, box 8L + <@@ 2uL * 4uL @@>, box 8uL + <@@ 2.0f * 4.0f @@>, box 8f + <@@ 2.0 * 4.0 @@>, box 8. + <@@ 2m * 4m @@>, box 8m + <@@ 2m * 4m @@>, box 8m + <@@ 2I * 4I @@>, box 8I + <@@ LanguagePrimitives.GenericOne * LanguagePrimitives.GenericOne @@>, box 1n + <@@ LanguagePrimitives.GenericOne * LanguagePrimitives.GenericOne @@>, box 1un + <@@ Checked.(*) 2y 4y @@>, box 8y + <@@ Checked.(*) 2uy 4uy @@>, box 8uy + <@@ Checked.(*) 2s 4s @@>, box 8s + <@@ Checked.(*) 2us 4us @@>, box 8us + <@@ Checked.(*) 2 4 @@>, box 8 + <@@ Checked.(*) 2u 4u @@>, box 8u + <@@ Checked.(*) 2L 4L @@>, box 8L + <@@ Checked.(*) 2uL 4uL @@>, box 8uL + <@@ Checked.(*) 2.0f 4.0f @@>, box 8f + <@@ Checked.(*) 2.0 4.0 @@>, box 8. + <@@ Checked.(*) 2m 4m @@>, box 8m + <@@ Checked.(*) 2m 4m @@>, box 8m + <@@ Checked.(*) 2I 4I @@>, box 8I + <@@ Checked.(*) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box 1n + <@@ Checked.(*) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box 1un + + <@@ 6y / 3y @@>, box 2y + <@@ 6uy / 3uy @@>, box 2uy + <@@ 6s / 3s @@>, box 2s + <@@ 6us / 3us @@>, box 2us + <@@ 6 / 3 @@>, box 2 + <@@ 6u / 3u @@>, box 2u + <@@ 6L / 3L @@>, box 2L + <@@ 6uL / 3uL @@>, box 2uL + <@@ 6.0f / 3.0f @@>, box 2f + <@@ 6.0 / 3.0 @@>, box 2. + <@@ 6m / 3m @@>, box 2m + <@@ 6m / 3m @@>, box 2m + <@@ 6I / 3I @@>, box 2I + <@@ LanguagePrimitives.GenericOne / LanguagePrimitives.GenericOne @@>, box 1n + <@@ LanguagePrimitives.GenericOne / LanguagePrimitives.GenericOne @@>, box 1un + + <@@ 9y % 4y @@>, box 1y + <@@ 9uy % 4uy @@>, box 1uy + <@@ 9s % 4s @@>, box 1s + <@@ 9us % 4us @@>, box 1us + <@@ 9 % 4 @@>, box 1 + <@@ 9u % 4u @@>, box 1u + <@@ 9L % 4L @@>, box 1L + <@@ 9uL % 4uL @@>, box 1uL + <@@ 9.0f % 4.0f @@>, box 1f + <@@ 9.0 % 4.0 @@>, box 1. + <@@ 9m % 4m @@>, box 1m + <@@ 9m % 4m @@>, box 1m + <@@ 9I % 4I @@>, box 1I + <@@ LanguagePrimitives.GenericOne % LanguagePrimitives.GenericOne @@>, box 0n + <@@ LanguagePrimitives.GenericOne % LanguagePrimitives.GenericOne @@>, box 0un + + <@@ +(1y) @@>, box 1y + <@@ +(1uy) @@>, box 1uy + <@@ +(1s) @@>, box 1s + <@@ +(1us) @@>, box 1us + <@@ +(1) @@>, box 1 + <@@ +(1u) @@>, box 1u + <@@ +(1L) @@>, box 1L + <@@ +(1uL) @@>, box 1uL + <@@ +(1f) @@>, box 1f + <@@ +(1.) @@>, box 1. + <@@ +(1m) @@>, box 1m + <@@ +(1m) @@>, box 1m + <@@ +(1I) @@>, box 1I + <@@ +(LanguagePrimitives.GenericOne) @@>, box 1n + <@@ +(LanguagePrimitives.GenericOne) @@>, box 1un + + <@@ -(1y) @@>, box -1y + <@@ -(1s) @@>, box -1s + <@@ -(1) @@>, box -1 + <@@ -(1L) @@>, box -1L + <@@ -(1f) @@>, box -1f + <@@ -(1.) @@>, box -1. + <@@ -(1m) @@>, box -1m + <@@ -(1m) @@>, box -1m + <@@ -(1I) @@>, box -1I + <@@ -(LanguagePrimitives.GenericOne) @@>, box -1n + <@@ Checked.(~-) (1y) @@>, box -1y + <@@ Checked.(~-) (1s) @@>, box -1s + <@@ Checked.(~-) (1) @@>, box -1 + <@@ Checked.(~-) (1L) @@>, box -1L + <@@ Checked.(~-) (1f) @@>, box -1f + <@@ Checked.(~-) (1.) @@>, box -1. + <@@ Checked.(~-) (1m) @@>, box -1m + <@@ Checked.(~-) (1m) @@>, box -1m + <@@ Checked.(~-) (1I) @@>, box -1I + <@@ Checked.(~-) (LanguagePrimitives.GenericOne) @@>, box -1n + + <@@ 4f ** 3f @@>, box 64f + <@@ 4. ** 3. @@>, box 64. + <@@ 4I ** 3 @@>, box 64I + + <@@ 1y <<< 3 @@>, box 8y + <@@ 1uy <<< 3 @@>, box 8uy + <@@ 1s <<< 3 @@>, box 8s + <@@ 1us <<< 3 @@>, box 8us + <@@ 1 <<< 3 @@>, box 8 + <@@ 1u <<< 3 @@>, box 8u + <@@ 1L <<< 3 @@>, box 8L + <@@ 1UL <<< 3 @@>, box 8UL + <@@ 1I <<< 3 @@>, box 8I + <@@ LanguagePrimitives.GenericOne <<< 3 @@>, box 8n + <@@ LanguagePrimitives.GenericOne <<< 3 @@>, box 8un + + <@@ 1y >>> 3 @@>, box 0y + <@@ 1uy >>> 3 @@>, box 0uy + <@@ 1s >>> 3 @@>, box 0s + <@@ 1us >>> 3 @@>, box 0us + <@@ 1 >>> 3 @@>, box 0 + <@@ 1u >>> 3 @@>, box 0u + <@@ 1L >>> 3 @@>, box 0L + <@@ 1UL >>> 3 @@>, box 0UL + <@@ 1I >>> 3 @@>, box 0I + <@@ LanguagePrimitives.GenericOne >>> 3 @@>, box 0n + <@@ LanguagePrimitives.GenericOne >>> 3 @@>, box 0un - <@@ uint64 3uy @@>, true - <@@ uint64 3y @@>, true - <@@ uint64 3s @@>, true - <@@ uint64 3us @@>, true - <@@ uint64 3 @@>, true - <@@ uint64 3u @@>, true - <@@ uint64 3L @@>, true - <@@ uint64 3UL @@>, true - <@@ uint64 3.0f @@>, true - <@@ uint64 3.0 @@>, true - <@@ uint64 LanguagePrimitives.GenericOne @@>, false - <@@ uint64 LanguagePrimitives.GenericOne @@>, false - <@@ uint64 3.0M @@>, true - <@@ uint64 "3" @@>, false - - <@@ nativeint 3uy @@>, true - <@@ nativeint 3y @@>, true - <@@ nativeint 3s @@>, true - <@@ nativeint 3us @@>, true - <@@ nativeint 3 @@>, true - <@@ nativeint 3u @@>, true - <@@ nativeint 3L @@>, true - <@@ nativeint 3UL @@>, true - <@@ nativeint 3.0f @@>, true - <@@ nativeint 3.0 @@>, true - <@@ nativeint LanguagePrimitives.GenericOne @@>, false - <@@ nativeint LanguagePrimitives.GenericOne @@>, false - //<@@ nativeint 3.0M @@>, false - //<@@ nativeint "3" @@>, false - - <@@ unativeint 3uy @@>, true - <@@ unativeint 3y @@>, true - <@@ unativeint 3s @@>, true - <@@ unativeint 3us @@>, true - <@@ unativeint 3 @@>, true - <@@ unativeint 3u @@>, true - <@@ unativeint 3L @@>, true - <@@ unativeint 3UL @@>, true - <@@ unativeint 3.0f @@>, true - <@@ unativeint 3.0 @@>, true - <@@ unativeint LanguagePrimitives.GenericOne @@>, false - <@@ unativeint LanguagePrimitives.GenericOne @@>, false - //<@@ unativeint 3.0M @@>, true - //<@@ unativeint "3" @@>, true - - <@@ LanguagePrimitives.GenericZero @@>, true - <@@ LanguagePrimitives.GenericZero @@>, true - <@@ LanguagePrimitives.GenericZero @@>, true - <@@ LanguagePrimitives.GenericZero @@>, true - <@@ LanguagePrimitives.GenericZero @@>, true - <@@ LanguagePrimitives.GenericZero @@>, true - <@@ LanguagePrimitives.GenericOne @@>, true - <@@ LanguagePrimitives.GenericOne @@>, true - <@@ LanguagePrimitives.GenericOne @@>, true - <@@ LanguagePrimitives.GenericOne @@>, true - <@@ LanguagePrimitives.GenericOne @@>, true - <@@ LanguagePrimitives.GenericOne @@>, true - <@@ List.sum [ 1; 2 ] @@>, true - <@@ List.sum [ 1.0f; 2.0f ] @@>, true - <@@ List.sum [ 1.0; 2.0 ] @@>, true - <@@ List.sum [ 1.0M; 2.0M ] @@>, true - <@@ List.average [ 1.0; 2.0 ] @@>, true - <@@ List.average [ 1.0f; 2.0f ] @@>, true - <@@ List.average [ 1.0M; 2.0M ] @@>, true - ] - - tests |> List.forall (fun (test, canEval) -> - if canEval then - printfn "--> checking we can evaluate %A" test - FSharp.Linq.RuntimeHelpers.LeafExpressionConverter.EvaluateQuotation test |> ignore - printfn "<-- evaluated!" - else - printfn "skipping evaluation of %A because LinqExpressionConverter can't handle it" test - printfn "checking %A" test + <@@ 1y &&& 3y @@>, box 1y + <@@ 1uy &&& 3uy @@>, box 1uy + <@@ 1s &&& 3s @@>, box 1s + <@@ 1us &&& 3us @@>, box 1us + <@@ 1 &&& 3 @@>, box 1 + <@@ 1u &&& 3u @@>, box 1u + <@@ 1L &&& 3L @@>, box 1L + <@@ 1UL &&& 3UL @@>, box 1UL + <@@ 1I &&& 3I @@>, box 1I + <@@ LanguagePrimitives.GenericOne &&& LanguagePrimitives.GenericOne @@>, box 1n + <@@ LanguagePrimitives.GenericOne &&& LanguagePrimitives.GenericOne @@>, box 1un + + <@@ 1y ||| 3y @@>, box 3y + <@@ 1uy ||| 3uy @@>, box 3uy + <@@ 1s ||| 3s @@>, box 3s + <@@ 1us ||| 3us @@>, box 3us + <@@ 1 ||| 3 @@>, box 3 + <@@ 1u ||| 3u @@>, box 3u + <@@ 1L ||| 3L @@>, box 3L + <@@ 1UL ||| 3UL @@>, box 3UL + <@@ 1I ||| 3I @@>, box 3I + <@@ LanguagePrimitives.GenericOne ||| LanguagePrimitives.GenericOne @@>, box 1n + <@@ LanguagePrimitives.GenericOne ||| LanguagePrimitives.GenericOne @@>, box 1un + + <@@ 1y ^^^ 3y @@>, box 2y + <@@ 1uy ^^^ 3uy @@>, box 2uy + <@@ 1s ^^^ 3s @@>, box 2s + <@@ 1us ^^^ 3us @@>, box 2us + <@@ 1 ^^^ 3 @@>, box 2 + <@@ 1u ^^^ 3u @@>, box 2u + <@@ 1L ^^^ 3L @@>, box 2L + <@@ 1UL ^^^ 3UL @@>, box 2UL + <@@ 1I ^^^ 3I @@>, box 2I + <@@ LanguagePrimitives.GenericOne ^^^ LanguagePrimitives.GenericOne @@>, box 0n + <@@ LanguagePrimitives.GenericOne ^^^ LanguagePrimitives.GenericOne @@>, box 0un + + <@@ ~~~3y @@>, box -4y + <@@ ~~~3uy @@>, box 252uy + <@@ ~~~3s @@>, box -4s + <@@ ~~~3us @@>, box 65532us + <@@ ~~~3 @@>, box -4 + <@@ ~~~3u @@>, box 4294967292u + <@@ ~~~3L @@>, box -4L + <@@ ~~~3UL @@>, box 18446744073709551612UL + <@@ ~~~LanguagePrimitives.GenericOne @@>, box ~~~1n + <@@ ~~~LanguagePrimitives.GenericOne @@>, box ~~~1un + + <@@ byte 3uy @@>, box 3uy + <@@ byte 3y @@>, box 3uy + <@@ byte 3s @@>, box 3uy + <@@ byte 3us @@>, box 3uy + <@@ byte 3 @@>, box 3uy + <@@ byte 3u @@>, box 3uy + <@@ byte 3L @@>, box 3uy + <@@ byte 3UL @@>, box 3uy + <@@ byte '\003' @@>, box 3uy + <@@ byte 3.0f @@>, box 3uy + <@@ byte 3.0 @@>, box 3uy + <@@ byte 3.0 @@>, box 3uy + <@@ byte 3I @@>, box 3uy + <@@ byte LanguagePrimitives.GenericOne @@>, box 1uy + <@@ byte LanguagePrimitives.GenericOne @@>, box 1uy + <@@ byte 3.0M @@>, box 3uy + <@@ byte "3" @@>, box 3uy + <@@ uint8 3uy @@>, box 3uy + <@@ uint8 3y @@>, box 3uy + <@@ uint8 3s @@>, box 3uy + <@@ uint8 3us @@>, box 3uy + <@@ uint8 3 @@>, box 3uy + <@@ uint8 3u @@>, box 3uy + <@@ uint8 3L @@>, box 3uy + <@@ uint8 3UL @@>, box 3uy + <@@ uint8 '\003' @@>, box 3uy + <@@ uint8 3.0f @@>, box 3uy + <@@ uint8 3.0 @@>, box 3uy + <@@ uint8 3.0 @@>, box 3uy + <@@ uint8 3I @@>, box 3uy + <@@ uint8 LanguagePrimitives.GenericOne @@>, box 1uy + <@@ uint8 LanguagePrimitives.GenericOne @@>, box 1uy + <@@ uint8 3.0M @@>, box 3uy + <@@ uint8 "3" @@>, box 3uy + <@@ Checked.byte 3uy @@>, box 3uy + <@@ Checked.byte 3y @@>, box 3uy + <@@ Checked.byte 3s @@>, box 3uy + <@@ Checked.byte 3us @@>, box 3uy + <@@ Checked.byte 3 @@>, box 3uy + <@@ Checked.byte 3u @@>, box 3uy + <@@ Checked.byte 3L @@>, box 3uy + <@@ Checked.byte 3UL @@>, box 3uy + <@@ Checked.byte '\003' @@>, box 3uy + <@@ Checked.byte 3.0f @@>, box 3uy + <@@ Checked.byte 3.0 @@>, box 3uy + <@@ Checked.byte 3.0 @@>, box 3uy + <@@ Checked.byte 3I @@>, box 3uy + <@@ Checked.byte LanguagePrimitives.GenericOne @@>, box 1uy + <@@ Checked.byte LanguagePrimitives.GenericOne @@>, box 1uy + <@@ Checked.byte 3.0M @@>, box 3uy + <@@ Checked.byte "3" @@>, box 3uy + <@@ Checked.uint8 3uy @@>, box 3uy + <@@ Checked.uint8 3y @@>, box 3uy + <@@ Checked.uint8 3s @@>, box 3uy + <@@ Checked.uint8 3us @@>, box 3uy + <@@ Checked.uint8 3 @@>, box 3uy + <@@ Checked.uint8 3u @@>, box 3uy + <@@ Checked.uint8 3L @@>, box 3uy + <@@ Checked.uint8 3UL @@>, box 3uy + <@@ Checked.uint8 '\003' @@>, box 3uy + <@@ Checked.uint8 3.0f @@>, box 3uy + <@@ Checked.uint8 3.0 @@>, box 3uy + <@@ Checked.uint8 3.0 @@>, box 3uy + <@@ Checked.uint8 3I @@>, box 3uy + <@@ Checked.uint8 LanguagePrimitives.GenericOne @@>, box 1uy + <@@ Checked.uint8 LanguagePrimitives.GenericOne @@>, box 1uy + <@@ Checked.uint8 3.0M @@>, box 3uy + <@@ Checked.uint8 "3" @@>, box 3uy + + <@@ sbyte 3uy @@>, box 3y + <@@ sbyte 3y @@>, box 3y + <@@ sbyte 3s @@>, box 3y + <@@ sbyte 3us @@>, box 3y + <@@ sbyte 3 @@>, box 3y + <@@ sbyte 3u @@>, box 3y + <@@ sbyte 3L @@>, box 3y + <@@ sbyte 3UL @@>, box 3y + <@@ sbyte '\003' @@>, box 3y + <@@ sbyte 3.0f @@>, box 3y + <@@ sbyte 3.0 @@>, box 3y + <@@ sbyte 3.0 @@>, box 3y + <@@ sbyte 3I @@>, box 3y + <@@ sbyte LanguagePrimitives.GenericOne @@>, box 1y + <@@ sbyte LanguagePrimitives.GenericOne @@>, box 1y + <@@ sbyte 3.0M @@>, box 3y + <@@ sbyte "3" @@>, box 3y + <@@ int8 3uy @@>, box 3y + <@@ int8 3y @@>, box 3y + <@@ int8 3s @@>, box 3y + <@@ int8 3us @@>, box 3y + <@@ int8 3 @@>, box 3y + <@@ int8 3u @@>, box 3y + <@@ int8 3L @@>, box 3y + <@@ int8 3UL @@>, box 3y + <@@ int8 '\003' @@>, box 3y + <@@ int8 3.0f @@>, box 3y + <@@ int8 3.0 @@>, box 3y + <@@ int8 3.0 @@>, box 3y + <@@ int8 3I @@>, box 3y + <@@ int8 LanguagePrimitives.GenericOne @@>, box 1y + <@@ int8 LanguagePrimitives.GenericOne @@>, box 1y + <@@ int8 3.0M @@>, box 3y + <@@ int8 "3" @@>, box 3y + <@@ Checked.sbyte 3uy @@>, box 3y + <@@ Checked.sbyte 3y @@>, box 3y + <@@ Checked.sbyte 3s @@>, box 3y + <@@ Checked.sbyte 3us @@>, box 3y + <@@ Checked.sbyte 3 @@>, box 3y + <@@ Checked.sbyte 3u @@>, box 3y + <@@ Checked.sbyte 3L @@>, box 3y + <@@ Checked.sbyte 3UL @@>, box 3y + <@@ Checked.sbyte '\003' @@>, box 3y + <@@ Checked.sbyte 3.0f @@>, box 3y + <@@ Checked.sbyte 3.0 @@>, box 3y + <@@ Checked.sbyte 3.0 @@>, box 3y + <@@ Checked.sbyte 3I @@>, box 3y + <@@ Checked.sbyte LanguagePrimitives.GenericOne @@>, box 1y + <@@ Checked.sbyte LanguagePrimitives.GenericOne @@>, box 1y + <@@ Checked.sbyte 3.0M @@>, box 3y + <@@ Checked.sbyte "3" @@>, box 3y + <@@ Checked.int8 3uy @@>, box 3y + <@@ Checked.int8 3y @@>, box 3y + <@@ Checked.int8 3s @@>, box 3y + <@@ Checked.int8 3us @@>, box 3y + <@@ Checked.int8 3 @@>, box 3y + <@@ Checked.int8 3u @@>, box 3y + <@@ Checked.int8 3L @@>, box 3y + <@@ Checked.int8 3UL @@>, box 3y + <@@ Checked.int8 '\003' @@>, box 3y + <@@ Checked.int8 3.0f @@>, box 3y + <@@ Checked.int8 3.0 @@>, box 3y + <@@ Checked.int8 3.0 @@>, box 3y + <@@ Checked.int8 3I @@>, box 3y + <@@ Checked.int8 LanguagePrimitives.GenericOne @@>, box 1y + <@@ Checked.int8 LanguagePrimitives.GenericOne @@>, box 1y + <@@ Checked.int8 3.0M @@>, box 3y + <@@ Checked.int8 "3" @@>, box 3y + + <@@ int16 3uy @@>, box 3s + <@@ int16 3y @@>, box 3s + <@@ int16 3s @@>, box 3s + <@@ int16 3us @@>, box 3s + <@@ int16 3 @@>, box 3s + <@@ int16 3u @@>, box 3s + <@@ int16 3L @@>, box 3s + <@@ int16 3UL @@>, box 3s + <@@ int16 '\003' @@>, box 3s + <@@ int16 3.0f @@>, box 3s + <@@ int16 3.0 @@>, box 3s + <@@ int16 3.0 @@>, box 3s + <@@ int16 3I @@>, box 3s + <@@ int16 LanguagePrimitives.GenericOne @@>, box 1s + <@@ int16 LanguagePrimitives.GenericOne @@>, box 1s + <@@ int16 3.0M @@>, box 3s + <@@ int16 "3" @@>, box 3s + <@@ Checked.int16 3uy @@>, box 3s + <@@ Checked.int16 3y @@>, box 3s + <@@ Checked.int16 3s @@>, box 3s + <@@ Checked.int16 3us @@>, box 3s + <@@ Checked.int16 3 @@>, box 3s + <@@ Checked.int16 3u @@>, box 3s + <@@ Checked.int16 3L @@>, box 3s + <@@ Checked.int16 3UL @@>, box 3s + <@@ Checked.int16 '\003' @@>, box 3s + <@@ Checked.int16 3.0f @@>, box 3s + <@@ Checked.int16 3.0 @@>, box 3s + <@@ Checked.int16 3.0 @@>, box 3s + <@@ Checked.int16 3I @@>, box 3s + <@@ Checked.int16 LanguagePrimitives.GenericOne @@>, box 1s + <@@ Checked.int16 LanguagePrimitives.GenericOne @@>, box 1s + <@@ Checked.int16 3.0M @@>, box 3s + <@@ Checked.int16 "3" @@>, box 3s + + <@@ uint16 3uy @@>, box 3us + <@@ uint16 3y @@>, box 3us + <@@ uint16 3s @@>, box 3us + <@@ uint16 3us @@>, box 3us + <@@ uint16 3 @@>, box 3us + <@@ uint16 3u @@>, box 3us + <@@ uint16 3L @@>, box 3us + <@@ uint16 3UL @@>, box 3us + <@@ uint16 '\003' @@>, box 3us + <@@ uint16 3.0f @@>, box 3us + <@@ uint16 3.0 @@>, box 3us + <@@ uint16 3.0 @@>, box 3us + <@@ uint16 3I @@>, box 3us + <@@ uint16 LanguagePrimitives.GenericOne @@>, box 1us + <@@ uint16 LanguagePrimitives.GenericOne @@>, box 1us + <@@ uint16 3.0M @@>, box 3us + <@@ uint16 "3" @@>, box 3us + <@@ Checked.uint16 3uy @@>, box 3us + <@@ Checked.uint16 3y @@>, box 3us + <@@ Checked.uint16 3s @@>, box 3us + <@@ Checked.uint16 3us @@>, box 3us + <@@ Checked.uint16 3 @@>, box 3us + <@@ Checked.uint16 3u @@>, box 3us + <@@ Checked.uint16 3L @@>, box 3us + <@@ Checked.uint16 3UL @@>, box 3us + <@@ Checked.uint16 '\003' @@>, box 3us + <@@ Checked.uint16 3.0f @@>, box 3us + <@@ Checked.uint16 3.0 @@>, box 3us + <@@ Checked.uint16 3.0 @@>, box 3us + <@@ Checked.uint16 3I @@>, box 3us + <@@ Checked.uint16 LanguagePrimitives.GenericOne @@>, box 1us + <@@ Checked.uint16 LanguagePrimitives.GenericOne @@>, box 1us + <@@ Checked.uint16 3.0M @@>, box 3us + <@@ Checked.uint16 "3" @@>, box 3us + + <@@ int 3uy @@>, box 3 + <@@ int 3y @@>, box 3 + <@@ int 3s @@>, box 3 + <@@ int 3us @@>, box 3 + <@@ int 3 @@>, box 3 + <@@ int 3u @@>, box 3 + <@@ int 3L @@>, box 3 + <@@ int 3UL @@>, box 3 + <@@ int '\003' @@>, box 3 + <@@ int 3.0f @@>, box 3 + <@@ int 3.0 @@>, box 3 + <@@ int 3.0 @@>, box 3 + <@@ int 3I @@>, box 3 + <@@ int LanguagePrimitives.GenericOne @@>, box 1 + <@@ int LanguagePrimitives.GenericOne @@>, box 1 + <@@ int 3.0M @@>, box 3 + <@@ int "3" @@>, box 3 + <@@ int32 3uy @@>, box 3 + <@@ int32 3y @@>, box 3 + <@@ int32 3s @@>, box 3 + <@@ int32 3us @@>, box 3 + <@@ int32 3 @@>, box 3 + <@@ int32 3u @@>, box 3 + <@@ int32 3L @@>, box 3 + <@@ int32 3UL @@>, box 3 + <@@ int32 '\003' @@>, box 3 + <@@ int32 3.0f @@>, box 3 + <@@ int32 3.0 @@>, box 3 + <@@ int32 3.0 @@>, box 3 + <@@ int32 3I @@>, box 3 + <@@ int32 LanguagePrimitives.GenericOne @@>, box 1 + <@@ int32 LanguagePrimitives.GenericOne @@>, box 1 + <@@ int32 3.0M @@>, box 3 + <@@ int32 "3" @@>, box 3 + <@@ Checked.int 3uy @@>, box 3 + <@@ Checked.int 3y @@>, box 3 + <@@ Checked.int 3s @@>, box 3 + <@@ Checked.int 3us @@>, box 3 + <@@ Checked.int 3 @@>, box 3 + <@@ Checked.int 3u @@>, box 3 + <@@ Checked.int 3L @@>, box 3 + <@@ Checked.int 3UL @@>, box 3 + <@@ Checked.int '\003' @@>, box 3 + <@@ Checked.int 3.0f @@>, box 3 + <@@ Checked.int 3.0 @@>, box 3 + <@@ Checked.int 3.0 @@>, box 3 + <@@ Checked.int 3I @@>, box 3 + <@@ Checked.int LanguagePrimitives.GenericOne @@>, box 1 + <@@ Checked.int LanguagePrimitives.GenericOne @@>, box 1 + <@@ Checked.int 3.0M @@>, box 3 + <@@ Checked.int "3" @@>, box 3 + <@@ Checked.int32 3uy @@>, box 3 + <@@ Checked.int32 3y @@>, box 3 + <@@ Checked.int32 3s @@>, box 3 + <@@ Checked.int32 3us @@>, box 3 + <@@ Checked.int32 3 @@>, box 3 + <@@ Checked.int32 3u @@>, box 3 + <@@ Checked.int32 3L @@>, box 3 + <@@ Checked.int32 3UL @@>, box 3 + <@@ Checked.int32 '\003' @@>, box 3 + <@@ Checked.int32 3.0f @@>, box 3 + <@@ Checked.int32 3.0 @@>, box 3 + <@@ Checked.int32 3.0 @@>, box 3 + <@@ Checked.int32 3I @@>, box 3 + <@@ Checked.int32 LanguagePrimitives.GenericOne @@>, box 1 + <@@ Checked.int32 LanguagePrimitives.GenericOne @@>, box 1 + <@@ Checked.int32 3.0M @@>, box 3 + <@@ Checked.int32 "3" @@>, box 3 + + <@@ uint 3uy @@>, box 3u + <@@ uint 3y @@>, box 3u + <@@ uint 3s @@>, box 3u + <@@ uint 3us @@>, box 3u + <@@ uint 3 @@>, box 3u + <@@ uint 3u @@>, box 3u + <@@ uint 3L @@>, box 3u + <@@ uint 3UL @@>, box 3u + <@@ uint '\003' @@>, box 3u + <@@ uint 3.0f @@>, box 3u + <@@ uint 3.0 @@>, box 3u + <@@ uint 3.0 @@>, box 3u + <@@ uint 3I @@>, box 3u + <@@ uint LanguagePrimitives.GenericOne @@>, box 1u + <@@ uint LanguagePrimitives.GenericOne @@>, box 1u + <@@ uint 3.0M @@>, box 3u + <@@ uint "3" @@>, box 3u + <@@ uint32 3uy @@>, box 3u + <@@ uint32 3y @@>, box 3u + <@@ uint32 3s @@>, box 3u + <@@ uint32 3us @@>, box 3u + <@@ uint32 3 @@>, box 3u + <@@ uint32 3u @@>, box 3u + <@@ uint32 3L @@>, box 3u + <@@ uint32 3UL @@>, box 3u + <@@ uint32 '\003' @@>, box 3u + <@@ uint32 3.0f @@>, box 3u + <@@ uint32 3.0 @@>, box 3u + <@@ uint32 3.0 @@>, box 3u + <@@ uint32 3I @@>, box 3u + <@@ uint32 LanguagePrimitives.GenericOne @@>, box 1u + <@@ uint32 LanguagePrimitives.GenericOne @@>, box 1u + <@@ uint32 3.0M @@>, box 3u + <@@ uint32 "3" @@>, box 3u + <@@ Checked.uint32 3uy @@>, box 3u + <@@ Checked.uint32 3y @@>, box 3u + <@@ Checked.uint32 3s @@>, box 3u + <@@ Checked.uint32 3us @@>, box 3u + <@@ Checked.uint32 3 @@>, box 3u + <@@ Checked.uint32 3u @@>, box 3u + <@@ Checked.uint32 3L @@>, box 3u + <@@ Checked.uint32 3UL @@>, box 3u + <@@ Checked.uint32 '\003' @@>, box 3u + <@@ Checked.uint32 3.0f @@>, box 3u + <@@ Checked.uint32 3.0 @@>, box 3u + <@@ Checked.uint32 3.0 @@>, box 3u + <@@ Checked.uint32 3I @@>, box 3u + <@@ Checked.uint32 LanguagePrimitives.GenericOne @@>, box 1u + <@@ Checked.uint32 LanguagePrimitives.GenericOne @@>, box 1u + <@@ Checked.uint32 3.0M @@>, box 3u + <@@ Checked.uint32 "3" @@>, box 3u + + <@@ int64 3uy @@>, box 3L + <@@ int64 3y @@>, box 3L + <@@ int64 3s @@>, box 3L + <@@ int64 3us @@>, box 3L + <@@ int64 3 @@>, box 3L + <@@ int64 3u @@>, box 3L + <@@ int64 3L @@>, box 3L + <@@ int64 3UL @@>, box 3L + <@@ int64 '\003' @@>, box 3L + <@@ int64 3.0f @@>, box 3L + <@@ int64 3.0 @@>, box 3L + <@@ int64 3.0 @@>, box 3L + <@@ int64 3I @@>, box 3L + <@@ int64 LanguagePrimitives.GenericOne @@>, box 1L + <@@ int64 LanguagePrimitives.GenericOne @@>, box 1L + <@@ int64 3.0M @@>, box 3L + <@@ int64 "3" @@>, box 3L + <@@ Checked.int64 3uy @@>, box 3L + <@@ Checked.int64 3y @@>, box 3L + <@@ Checked.int64 3s @@>, box 3L + <@@ Checked.int64 3us @@>, box 3L + <@@ Checked.int64 3 @@>, box 3L + <@@ Checked.int64 3u @@>, box 3L + <@@ Checked.int64 3L @@>, box 3L + <@@ Checked.int64 3UL @@>, box 3L + <@@ Checked.int64 '\003' @@>, box 3L + <@@ Checked.int64 3.0f @@>, box 3L + <@@ Checked.int64 3.0 @@>, box 3L + <@@ Checked.int64 3.0 @@>, box 3L + <@@ Checked.int64 3I @@>, box 3L + <@@ Checked.int64 LanguagePrimitives.GenericOne @@>, box 1L + <@@ Checked.int64 LanguagePrimitives.GenericOne @@>, box 1L + <@@ Checked.int64 3.0M @@>, box 3L + <@@ Checked.int64 "3" @@>, box 3L + + <@@ uint64 3uy @@>, box 3UL + <@@ uint64 3y @@>, box 3UL + <@@ uint64 3s @@>, box 3UL + <@@ uint64 3us @@>, box 3UL + <@@ uint64 3 @@>, box 3UL + <@@ uint64 3u @@>, box 3UL + <@@ uint64 3L @@>, box 3UL + <@@ uint64 3UL @@>, box 3UL + <@@ uint64 '\003' @@>, box 3UL + <@@ uint64 3.0f @@>, box 3UL + <@@ uint64 3.0 @@>, box 3UL + <@@ uint64 3.0 @@>, box 3UL + <@@ uint64 3I @@>, box 3UL + <@@ uint64 LanguagePrimitives.GenericOne @@>, box 1UL + <@@ uint64 LanguagePrimitives.GenericOne @@>, box 1UL + <@@ uint64 3.0M @@>, box 3UL + <@@ uint64 "3" @@>, box 3UL + <@@ Checked.uint64 3uy @@>, box 3UL + <@@ Checked.uint64 3y @@>, box 3UL + <@@ Checked.uint64 3s @@>, box 3UL + <@@ Checked.uint64 3us @@>, box 3UL + <@@ Checked.uint64 3 @@>, box 3UL + <@@ Checked.uint64 3u @@>, box 3UL + <@@ Checked.uint64 3L @@>, box 3UL + <@@ Checked.uint64 3UL @@>, box 3UL + <@@ Checked.uint64 '\003' @@>, box 3UL + <@@ Checked.uint64 3.0f @@>, box 3UL + <@@ Checked.uint64 3.0 @@>, box 3UL + <@@ Checked.uint64 3.0 @@>, box 3UL + <@@ Checked.uint64 3I @@>, box 3UL + <@@ Checked.uint64 LanguagePrimitives.GenericOne @@>, box 1UL + <@@ Checked.uint64 LanguagePrimitives.GenericOne @@>, box 1UL + <@@ Checked.uint64 3.0M @@>, box 3UL + <@@ Checked.uint64 "3" @@>, box 3UL + + <@@ char 51uy @@>, box '3' + <@@ char 51y @@>, box '3' + <@@ char 51s @@>, box '3' + <@@ char 51us @@>, box '3' + <@@ char 51 @@>, box '3' + <@@ char 51u @@>, box '3' + <@@ char 51L @@>, box '3' + <@@ char 51UL @@>, box '3' + <@@ char '3' @@>, box '3' + <@@ char 51.0f @@>, box '3' + <@@ char 51.0 @@>, box '3' + <@@ char 51.0 @@>, box '3' + <@@ char LanguagePrimitives.GenericOne @@>, box '\001' + <@@ char LanguagePrimitives.GenericOne @@>, box '\001' + <@@ char 51.0M @@>, box '3' + <@@ char "3" @@>, box '3' + <@@ Checked.char 51uy @@>, box '3' + <@@ Checked.char 51y @@>, box '3' + <@@ Checked.char 51s @@>, box '3' + <@@ Checked.char 51us @@>, box '3' + <@@ Checked.char 51 @@>, box '3' + <@@ Checked.char 51u @@>, box '3' + <@@ Checked.char 51L @@>, box '3' + <@@ Checked.char 51UL @@>, box '3' + <@@ Checked.char '3' @@>, box '3' + <@@ Checked.char 51.0f @@>, box '3' + <@@ Checked.char 51.0 @@>, box '3' + <@@ Checked.char 51.0 @@>, box '3' + <@@ Checked.char LanguagePrimitives.GenericOne @@>, box '\001' + <@@ Checked.char LanguagePrimitives.GenericOne @@>, box '\001' + <@@ Checked.char 51.0M @@>, box '3' + <@@ Checked.char "3" @@>, box '3' + + <@@ nativeint 3uy @@>, box 3n + <@@ nativeint 3y @@>, box 3n + <@@ nativeint 3s @@>, box 3n + <@@ nativeint 3us @@>, box 3n + <@@ nativeint 3 @@>, box 3n + <@@ nativeint 3u @@>, box 3n + <@@ nativeint 3L @@>, box 3n + <@@ nativeint 3UL @@>, box 3n + <@@ nativeint '\003' @@>, box 3n + <@@ nativeint 3.0f @@>, box 3n + <@@ nativeint 3.0 @@>, box 3n + <@@ nativeint 3.0 @@>, box 3n + <@@ nativeint LanguagePrimitives.GenericOne @@>, box 1n + <@@ nativeint LanguagePrimitives.GenericOne @@>, box 1n + <@@ nativeint 3.0M @@>, box 3n + <@@ nativeint "3" @@>, box 3n + <@@ Checked.nativeint 3uy @@>, box 3n + <@@ Checked.nativeint 3y @@>, box 3n + <@@ Checked.nativeint 3s @@>, box 3n + <@@ Checked.nativeint 3us @@>, box 3n + <@@ Checked.nativeint 3 @@>, box 3n + <@@ Checked.nativeint 3u @@>, box 3n + <@@ Checked.nativeint 3L @@>, box 3n + <@@ Checked.nativeint 3UL @@>, box 3n + <@@ Checked.nativeint '\003' @@>, box 3n + <@@ Checked.nativeint 3.0f @@>, box 3n + <@@ Checked.nativeint 3.0 @@>, box 3n + <@@ Checked.nativeint 3.0 @@>, box 3n + <@@ Checked.nativeint LanguagePrimitives.GenericOne @@>, box 1n + <@@ Checked.nativeint LanguagePrimitives.GenericOne @@>, box 1n + <@@ Checked.nativeint 3.0M @@>, box 3n + <@@ Checked.nativeint "3" @@>, box 3n + + <@@ unativeint 3uy @@>, box 3un + <@@ unativeint 3y @@>, box 3un + <@@ unativeint 3s @@>, box 3un + <@@ unativeint 3us @@>, box 3un + <@@ unativeint 3 @@>, box 3un + <@@ unativeint 3u @@>, box 3un + <@@ unativeint 3L @@>, box 3un + <@@ unativeint 3UL @@>, box 3un + <@@ unativeint '\003' @@>, box 3un + <@@ unativeint 3.0f @@>, box 3un + <@@ unativeint 3.0 @@>, box 3un + <@@ unativeint 3.0 @@>, box 3un + <@@ unativeint LanguagePrimitives.GenericOne @@>, box 1un + <@@ unativeint LanguagePrimitives.GenericOne @@>, box 1un + <@@ unativeint 3.0M @@>, box 3un + <@@ unativeint "3" @@>, box 3un + <@@ Checked.unativeint 3uy @@>, box 3un + <@@ Checked.unativeint 3y @@>, box 3un + <@@ Checked.unativeint 3s @@>, box 3un + <@@ Checked.unativeint 3us @@>, box 3un + <@@ Checked.unativeint 3 @@>, box 3un + <@@ Checked.unativeint 3u @@>, box 3un + <@@ Checked.unativeint 3L @@>, box 3un + <@@ Checked.unativeint 3UL @@>, box 3un + <@@ Checked.unativeint '\003' @@>, box 3un + <@@ Checked.unativeint 3.0f @@>, box 3un + <@@ Checked.unativeint 3.0 @@>, box 3un + <@@ Checked.unativeint 3.0 @@>, box 3un + <@@ Checked.unativeint LanguagePrimitives.GenericOne @@>, box 1un + <@@ Checked.unativeint LanguagePrimitives.GenericOne @@>, box 1un + <@@ Checked.unativeint 3.0M @@>, box 3un + <@@ Checked.unativeint "3" @@>, box 3un + + <@@ single 3uy @@>, box 3f + <@@ single 3y @@>, box 3f + <@@ single 3s @@>, box 3f + <@@ single 3us @@>, box 3f + <@@ single 3 @@>, box 3f + <@@ single 3u @@>, box 3f + <@@ single 3L @@>, box 3f + <@@ single 3UL @@>, box 3f + <@@ single '\003' @@>, box 3f + <@@ single 3.0f @@>, box 3f + <@@ single 3.0 @@>, box 3f + <@@ single 3.0 @@>, box 3f + <@@ single 3I @@>, box 3f + <@@ single LanguagePrimitives.GenericOne @@>, box 1f + <@@ single LanguagePrimitives.GenericOne @@>, box 1f + <@@ single 3.0M @@>, box 3f + <@@ single "3" @@>, box 3f + <@@ float32 3uy @@>, box 3f + <@@ float32 3y @@>, box 3f + <@@ float32 3s @@>, box 3f + <@@ float32 3us @@>, box 3f + <@@ float32 3 @@>, box 3f + <@@ float32 3u @@>, box 3f + <@@ float32 3L @@>, box 3f + <@@ float32 3UL @@>, box 3f + <@@ float32 '\003' @@>, box 3f + <@@ float32 3.0f @@>, box 3f + <@@ float32 3.0 @@>, box 3f + <@@ float32 3.0 @@>, box 3f + <@@ float32 3I @@>, box 3f + <@@ float32 LanguagePrimitives.GenericOne @@>, box 1f + <@@ float32 LanguagePrimitives.GenericOne @@>, box 1f + <@@ float32 3.0M @@>, box 3f + <@@ float32 "3" @@>, box 3f + + <@@ double 3uy @@>, box 3. + <@@ double 3y @@>, box 3. + <@@ double 3s @@>, box 3. + <@@ double 3us @@>, box 3. + <@@ double 3 @@>, box 3. + <@@ double 3u @@>, box 3. + <@@ double 3L @@>, box 3. + <@@ double 3UL @@>, box 3. + <@@ double '\003' @@>, box 3. + <@@ double 3.0f @@>, box 3. + <@@ double 3.0 @@>, box 3. + <@@ double 3.0 @@>, box 3. + <@@ double 3I @@>, box 3. + <@@ double LanguagePrimitives.GenericOne @@>, box 1. + <@@ double LanguagePrimitives.GenericOne @@>, box 1. + <@@ double 3.0M @@>, box 3. + <@@ double "3" @@>, box 3. + <@@ float 3uy @@>, box 3. + <@@ float 3y @@>, box 3. + <@@ float 3s @@>, box 3. + <@@ float 3us @@>, box 3. + <@@ float 3 @@>, box 3. + <@@ float 3u @@>, box 3. + <@@ float 3L @@>, box 3. + <@@ float 3UL @@>, box 3. + <@@ float '\003' @@>, box 3. + <@@ float 3.0f @@>, box 3. + <@@ float 3.0 @@>, box 3. + <@@ float 3.0 @@>, box 3. + <@@ float 3I @@>, box 3. + <@@ float LanguagePrimitives.GenericOne @@>, box 1. + <@@ float LanguagePrimitives.GenericOne @@>, box 1. + <@@ float 3.0M @@>, box 3. + <@@ float "3" @@>, box 3. + + <@@ decimal 3uy @@>, box 3m + <@@ decimal 3y @@>, box 3m + <@@ decimal 3s @@>, box 3m + <@@ decimal 3us @@>, box 3m + <@@ decimal 3 @@>, box 3m + <@@ decimal 3u @@>, box 3m + <@@ decimal 3L @@>, box 3m + <@@ decimal 3UL @@>, box 3m + <@@ decimal '\003' @@>, box 3m + <@@ decimal 3.0f @@>, box 3m + <@@ decimal 3.0 @@>, box 3m + <@@ decimal 3.0 @@>, box 3m + <@@ decimal 3I @@>, box 3m + <@@ decimal LanguagePrimitives.GenericOne @@>, box 1m + <@@ decimal LanguagePrimitives.GenericOne @@>, box 1m + <@@ decimal 3.0M @@>, box 3m + <@@ decimal "3" @@>, box 3m + + <@@ LanguagePrimitives.GenericZero @@>, box 0uy + <@@ LanguagePrimitives.GenericZero @@>, box 0uy + <@@ LanguagePrimitives.GenericZero @@>, box 0y + <@@ LanguagePrimitives.GenericZero @@>, box 0y + <@@ LanguagePrimitives.GenericZero @@>, box 0s + <@@ LanguagePrimitives.GenericZero @@>, box 0us + <@@ LanguagePrimitives.GenericZero @@>, box 0 + <@@ LanguagePrimitives.GenericZero @@>, box 0 + <@@ LanguagePrimitives.GenericZero @@>, box 0u + <@@ LanguagePrimitives.GenericZero @@>, box 0u + <@@ LanguagePrimitives.GenericZero @@>, box 0L + <@@ LanguagePrimitives.GenericZero @@>, box 0UL + <@@ LanguagePrimitives.GenericZero @@>, box 0I + <@@ LanguagePrimitives.GenericZero @@>, box '\000' + <@@ LanguagePrimitives.GenericZero @@>, box 0n + <@@ LanguagePrimitives.GenericZero @@>, box 0un + <@@ LanguagePrimitives.GenericZero @@>, box 0f + <@@ LanguagePrimitives.GenericZero @@>, box 0. + <@@ LanguagePrimitives.GenericZero @@>, box 0m + <@@ LanguagePrimitives.GenericZero> @@>, box 0m + + <@@ LanguagePrimitives.GenericOne @@>, box 1uy + <@@ LanguagePrimitives.GenericOne @@>, box 1uy + <@@ LanguagePrimitives.GenericOne @@>, box 1y + <@@ LanguagePrimitives.GenericOne @@>, box 1y + <@@ LanguagePrimitives.GenericOne @@>, box 1s + <@@ LanguagePrimitives.GenericOne @@>, box 1us + <@@ LanguagePrimitives.GenericOne @@>, box 1 + <@@ LanguagePrimitives.GenericOne @@>, box 1 + <@@ LanguagePrimitives.GenericOne @@>, box 1u + <@@ LanguagePrimitives.GenericOne @@>, box 1u + <@@ LanguagePrimitives.GenericOne @@>, box 1L + <@@ LanguagePrimitives.GenericOne @@>, box 1UL + <@@ LanguagePrimitives.GenericOne @@>, box 1I + <@@ LanguagePrimitives.GenericOne @@>, box '\001' + <@@ LanguagePrimitives.GenericOne @@>, box 1n + <@@ LanguagePrimitives.GenericOne @@>, box 1un + <@@ LanguagePrimitives.GenericOne @@>, box 1f + <@@ LanguagePrimitives.GenericOne @@>, box 1. + <@@ LanguagePrimitives.GenericOne @@>, box 1m + //<@@ LanguagePrimitives.GenericOne> @@>, box 1m // Doesn't typecheck + + <@@ List.sum [ 1; 2 ] @@>, box 3 + <@@ List.sum [ 1I; 2I ] @@>, box 3I + <@@ List.sum [ 1.0f; 2.0f ] @@>, box 3f + <@@ List.sum [ 1.0; 2.0 ] @@>, box 3. + <@@ List.sum [ 1.0M; 2.0M ] @@>, box 3m + <@@ List.sum [ 1.0M; 2.0M ] @@>, box 3m + <@@ List.average [ 1.0; 2.0 ] @@>, box 1.5 + <@@ List.average [ 1.0f; 2.0f ] @@>, box 1.5f + <@@ List.average [ 1.0M; 2.0M ] @@>, box 1.5m + <@@ List.average [ 1.0M; 2.0M ] @@>, box 1.5m + + <@@ Nullable.byte (Nullable<_> 3uy) @@>, box 3uy + <@@ Nullable.byte (Nullable<_> 3y) @@>, box 3uy + <@@ Nullable.byte (Nullable<_> 3s) @@>, box 3uy + <@@ Nullable.byte (Nullable<_> 3us) @@>, box 3uy + <@@ Nullable.byte (Nullable<_> 3) @@>, box 3uy + <@@ Nullable.byte (Nullable<_> 3u) @@>, box 3uy + <@@ Nullable.byte (Nullable<_> 3L) @@>, box 3uy + <@@ Nullable.byte (Nullable<_> 3UL) @@>, box 3uy + <@@ Nullable.byte (Nullable<_> '\003') @@>, box 3uy + <@@ Nullable.byte (Nullable<_> 3.0f) @@>, box 3uy + <@@ Nullable.byte (Nullable<_> 3.0) @@>, box 3uy + <@@ Nullable.byte (Nullable<_> 3.0) @@>, box 3uy + <@@ Nullable.byte (Nullable<_> 3I) @@>, box 3uy + <@@ Nullable.byte (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1uy + <@@ Nullable.byte (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1uy + <@@ Nullable.byte (Nullable<_> 3.0M) @@>, box 3uy + <@@ Nullable.uint8 (Nullable<_> 3uy) @@>, box 3uy + <@@ Nullable.uint8 (Nullable<_> 3y) @@>, box 3uy + <@@ Nullable.uint8 (Nullable<_> 3s) @@>, box 3uy + <@@ Nullable.uint8 (Nullable<_> 3us) @@>, box 3uy + <@@ Nullable.uint8 (Nullable<_> 3) @@>, box 3uy + <@@ Nullable.uint8 (Nullable<_> 3u) @@>, box 3uy + <@@ Nullable.uint8 (Nullable<_> 3L) @@>, box 3uy + <@@ Nullable.uint8 (Nullable<_> 3UL) @@>, box 3uy + <@@ Nullable.uint8 (Nullable<_> '\003') @@>, box 3uy + <@@ Nullable.uint8 (Nullable<_> 3.0f) @@>, box 3uy + <@@ Nullable.uint8 (Nullable<_> 3.0) @@>, box 3uy + <@@ Nullable.uint8 (Nullable<_> 3.0) @@>, box 3uy + <@@ Nullable.uint8 (Nullable<_> 3I) @@>, box 3uy + <@@ Nullable.uint8 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1uy + <@@ Nullable.uint8 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1uy + <@@ Nullable.uint8 (Nullable<_> 3.0M) @@>, box 3uy + + <@@ Nullable.sbyte (Nullable<_> 3uy) @@>, box 3y + <@@ Nullable.sbyte (Nullable<_> 3y) @@>, box 3y + <@@ Nullable.sbyte (Nullable<_> 3s) @@>, box 3y + <@@ Nullable.sbyte (Nullable<_> 3us) @@>, box 3y + <@@ Nullable.sbyte (Nullable<_> 3) @@>, box 3y + <@@ Nullable.sbyte (Nullable<_> 3u) @@>, box 3y + <@@ Nullable.sbyte (Nullable<_> 3L) @@>, box 3y + <@@ Nullable.sbyte (Nullable<_> 3UL) @@>, box 3y + <@@ Nullable.sbyte (Nullable<_> '\003') @@>, box 3y + <@@ Nullable.sbyte (Nullable<_> 3.0f) @@>, box 3y + <@@ Nullable.sbyte (Nullable<_> 3.0) @@>, box 3y + <@@ Nullable.sbyte (Nullable<_> 3.0) @@>, box 3y + <@@ Nullable.sbyte (Nullable<_> 3I) @@>, box 3y + <@@ Nullable.sbyte (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1y + <@@ Nullable.sbyte (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1y + <@@ Nullable.sbyte (Nullable<_> 3.0M) @@>, box 3y + <@@ Nullable.int8 (Nullable<_> 3uy) @@>, box 3y + <@@ Nullable.int8 (Nullable<_> 3y) @@>, box 3y + <@@ Nullable.int8 (Nullable<_> 3s) @@>, box 3y + <@@ Nullable.int8 (Nullable<_> 3us) @@>, box 3y + <@@ Nullable.int8 (Nullable<_> 3) @@>, box 3y + <@@ Nullable.int8 (Nullable<_> 3u) @@>, box 3y + <@@ Nullable.int8 (Nullable<_> 3L) @@>, box 3y + <@@ Nullable.int8 (Nullable<_> 3UL) @@>, box 3y + <@@ Nullable.int8 (Nullable<_> '\003') @@>, box 3y + <@@ Nullable.int8 (Nullable<_> 3.0f) @@>, box 3y + <@@ Nullable.int8 (Nullable<_> 3.0) @@>, box 3y + <@@ Nullable.int8 (Nullable<_> 3.0) @@>, box 3y + <@@ Nullable.int8 (Nullable<_> 3I) @@>, box 3y + <@@ Nullable.int8 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1y + <@@ Nullable.int8 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1y + <@@ Nullable.int8 (Nullable<_> 3.0M) @@>, box 3y + + <@@ Nullable.int16 (Nullable<_> 3uy) @@>, box 3s + <@@ Nullable.int16 (Nullable<_> 3y) @@>, box 3s + <@@ Nullable.int16 (Nullable<_> 3s) @@>, box 3s + <@@ Nullable.int16 (Nullable<_> 3us) @@>, box 3s + <@@ Nullable.int16 (Nullable<_> 3) @@>, box 3s + <@@ Nullable.int16 (Nullable<_> 3u) @@>, box 3s + <@@ Nullable.int16 (Nullable<_> 3L) @@>, box 3s + <@@ Nullable.int16 (Nullable<_> 3UL) @@>, box 3s + <@@ Nullable.int16 (Nullable<_> '\003') @@>, box 3s + <@@ Nullable.int16 (Nullable<_> 3.0f) @@>, box 3s + <@@ Nullable.int16 (Nullable<_> 3.0) @@>, box 3s + <@@ Nullable.int16 (Nullable<_> 3.0) @@>, box 3s + <@@ Nullable.int16 (Nullable<_> 3I) @@>, box 3s + <@@ Nullable.int16 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1s + <@@ Nullable.int16 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1s + <@@ Nullable.int16 (Nullable<_> 3.0M) @@>, box 3s + + <@@ Nullable.uint16 (Nullable<_> 3uy) @@>, box 3us + <@@ Nullable.uint16 (Nullable<_> 3y) @@>, box 3us + <@@ Nullable.uint16 (Nullable<_> 3s) @@>, box 3us + <@@ Nullable.uint16 (Nullable<_> 3us) @@>, box 3us + <@@ Nullable.uint16 (Nullable<_> 3) @@>, box 3us + <@@ Nullable.uint16 (Nullable<_> 3u) @@>, box 3us + <@@ Nullable.uint16 (Nullable<_> 3L) @@>, box 3us + <@@ Nullable.uint16 (Nullable<_> 3UL) @@>, box 3us + <@@ Nullable.uint16 (Nullable<_> '\003') @@>, box 3us + <@@ Nullable.uint16 (Nullable<_> 3.0f) @@>, box 3us + <@@ Nullable.uint16 (Nullable<_> 3.0) @@>, box 3us + <@@ Nullable.uint16 (Nullable<_> 3.0) @@>, box 3us + <@@ Nullable.uint16 (Nullable<_> 3I) @@>, box 3us + <@@ Nullable.uint16 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1us + <@@ Nullable.uint16 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1us + <@@ Nullable.uint16 (Nullable<_> 3.0M) @@>, box 3us + + <@@ Nullable.int (Nullable<_> 3uy) @@>, box 3 + <@@ Nullable.int (Nullable<_> 3y) @@>, box 3 + <@@ Nullable.int (Nullable<_> 3s) @@>, box 3 + <@@ Nullable.int (Nullable<_> 3us) @@>, box 3 + <@@ Nullable.int (Nullable<_> 3) @@>, box 3 + <@@ Nullable.int (Nullable<_> 3u) @@>, box 3 + <@@ Nullable.int (Nullable<_> 3L) @@>, box 3 + <@@ Nullable.int (Nullable<_> 3UL) @@>, box 3 + <@@ Nullable.int (Nullable<_> '\003') @@>, box 3 + <@@ Nullable.int (Nullable<_> 3.0f) @@>, box 3 + <@@ Nullable.int (Nullable<_> 3.0) @@>, box 3 + <@@ Nullable.int (Nullable<_> 3.0) @@>, box 3 + <@@ Nullable.int (Nullable<_> 3I) @@>, box 3 + <@@ Nullable.int (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1 + <@@ Nullable.int (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1 + <@@ Nullable.int (Nullable<_> 3.0M) @@>, box 3 + <@@ Nullable.int32 (Nullable<_> 3uy) @@>, box 3 + <@@ Nullable.int32 (Nullable<_> 3y) @@>, box 3 + <@@ Nullable.int32 (Nullable<_> 3s) @@>, box 3 + <@@ Nullable.int32 (Nullable<_> 3us) @@>, box 3 + <@@ Nullable.int32 (Nullable<_> 3) @@>, box 3 + <@@ Nullable.int32 (Nullable<_> 3u) @@>, box 3 + <@@ Nullable.int32 (Nullable<_> 3L) @@>, box 3 + <@@ Nullable.int32 (Nullable<_> 3UL) @@>, box 3 + <@@ Nullable.int32 (Nullable<_> '\003') @@>, box 3 + <@@ Nullable.int32 (Nullable<_> 3.0f) @@>, box 3 + <@@ Nullable.int32 (Nullable<_> 3.0) @@>, box 3 + <@@ Nullable.int32 (Nullable<_> 3.0) @@>, box 3 + <@@ Nullable.int32 (Nullable<_> 3I) @@>, box 3 + <@@ Nullable.int32 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1 + <@@ Nullable.int32 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1 + <@@ Nullable.int32 (Nullable<_> 3.0M) @@>, box 3 + + <@@ Nullable.uint (Nullable<_> 3uy) @@>, box 3u + <@@ Nullable.uint (Nullable<_> 3y) @@>, box 3u + <@@ Nullable.uint (Nullable<_> 3s) @@>, box 3u + <@@ Nullable.uint (Nullable<_> 3us) @@>, box 3u + <@@ Nullable.uint (Nullable<_> 3) @@>, box 3u + <@@ Nullable.uint (Nullable<_> 3u) @@>, box 3u + <@@ Nullable.uint (Nullable<_> 3L) @@>, box 3u + <@@ Nullable.uint (Nullable<_> 3UL) @@>, box 3u + <@@ Nullable.uint (Nullable<_> '\003') @@>, box 3u + <@@ Nullable.uint (Nullable<_> 3.0f) @@>, box 3u + <@@ Nullable.uint (Nullable<_> 3.0) @@>, box 3u + <@@ Nullable.uint (Nullable<_> 3.0) @@>, box 3u + <@@ Nullable.uint (Nullable<_> 3I) @@>, box 3u + <@@ Nullable.uint (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1u + <@@ Nullable.uint (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1u + <@@ Nullable.uint (Nullable<_> 3.0M) @@>, box 3u + <@@ Nullable.uint32 (Nullable<_> 3uy) @@>, box 3u + <@@ Nullable.uint32 (Nullable<_> 3y) @@>, box 3u + <@@ Nullable.uint32 (Nullable<_> 3s) @@>, box 3u + <@@ Nullable.uint32 (Nullable<_> 3us) @@>, box 3u + <@@ Nullable.uint32 (Nullable<_> 3) @@>, box 3u + <@@ Nullable.uint32 (Nullable<_> 3u) @@>, box 3u + <@@ Nullable.uint32 (Nullable<_> 3L) @@>, box 3u + <@@ Nullable.uint32 (Nullable<_> 3UL) @@>, box 3u + <@@ Nullable.uint32 (Nullable<_> '\003') @@>, box 3u + <@@ Nullable.uint32 (Nullable<_> 3.0f) @@>, box 3u + <@@ Nullable.uint32 (Nullable<_> 3.0) @@>, box 3u + <@@ Nullable.uint32 (Nullable<_> 3.0) @@>, box 3u + <@@ Nullable.uint32 (Nullable<_> 3I) @@>, box 3u + <@@ Nullable.uint32 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1u + <@@ Nullable.uint32 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1u + <@@ Nullable.uint32 (Nullable<_> 3.0M) @@>, box 3u + + <@@ Nullable.int64 (Nullable<_> 3uy) @@>, box 3L + <@@ Nullable.int64 (Nullable<_> 3y) @@>, box 3L + <@@ Nullable.int64 (Nullable<_> 3s) @@>, box 3L + <@@ Nullable.int64 (Nullable<_> 3us) @@>, box 3L + <@@ Nullable.int64 (Nullable<_> 3) @@>, box 3L + <@@ Nullable.int64 (Nullable<_> 3u) @@>, box 3L + <@@ Nullable.int64 (Nullable<_> 3L) @@>, box 3L + <@@ Nullable.int64 (Nullable<_> 3UL) @@>, box 3L + <@@ Nullable.int64 (Nullable<_> '\003') @@>, box 3L + <@@ Nullable.int64 (Nullable<_> 3.0f) @@>, box 3L + <@@ Nullable.int64 (Nullable<_> 3.0) @@>, box 3L + <@@ Nullable.int64 (Nullable<_> 3.0) @@>, box 3L + <@@ Nullable.int64 (Nullable<_> 3I) @@>, box 3L + <@@ Nullable.int64 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1L + <@@ Nullable.int64 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1L + <@@ Nullable.int64 (Nullable<_> 3.0M) @@>, box 3L + + <@@ Nullable.uint64 (Nullable<_> 3uy) @@>, box 3UL + <@@ Nullable.uint64 (Nullable<_> 3y) @@>, box 3UL + <@@ Nullable.uint64 (Nullable<_> 3s) @@>, box 3UL + <@@ Nullable.uint64 (Nullable<_> 3us) @@>, box 3UL + <@@ Nullable.uint64 (Nullable<_> 3) @@>, box 3UL + <@@ Nullable.uint64 (Nullable<_> 3u) @@>, box 3UL + <@@ Nullable.uint64 (Nullable<_> 3L) @@>, box 3UL + <@@ Nullable.uint64 (Nullable<_> 3UL) @@>, box 3UL + <@@ Nullable.uint64 (Nullable<_> '\003') @@>, box 3UL + <@@ Nullable.uint64 (Nullable<_> 3.0f) @@>, box 3UL + <@@ Nullable.uint64 (Nullable<_> 3.0) @@>, box 3UL + <@@ Nullable.uint64 (Nullable<_> 3.0) @@>, box 3UL + <@@ Nullable.uint64 (Nullable<_> 3I) @@>, box 3UL + <@@ Nullable.uint64 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1UL + <@@ Nullable.uint64 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1UL + <@@ Nullable.uint64 (Nullable<_> 3.0M) @@>, box 3UL + + <@@ Nullable.char (Nullable<_> 51uy) @@>, box '3' + <@@ Nullable.char (Nullable<_> 51y) @@>, box '3' + <@@ Nullable.char (Nullable<_> 51s) @@>, box '3' + <@@ Nullable.char (Nullable<_> 51us) @@>, box '3' + <@@ Nullable.char (Nullable<_> 51) @@>, box '3' + <@@ Nullable.char (Nullable<_> 51u) @@>, box '3' + <@@ Nullable.char (Nullable<_> 51L) @@>, box '3' + <@@ Nullable.char (Nullable<_> 51UL) @@>, box '3' + <@@ Nullable.char (Nullable<_> '3') @@>, box '3' + <@@ Nullable.char (Nullable<_> 51.0f) @@>, box '3' + <@@ Nullable.char (Nullable<_> 51.0) @@>, box '3' + <@@ Nullable.char (Nullable<_> 51.0) @@>, box '3' + <@@ Nullable.char (Nullable<_> LanguagePrimitives.GenericOne) @@>, box '\001' + <@@ Nullable.char (Nullable<_> LanguagePrimitives.GenericOne) @@>, box '\001' + <@@ Nullable.char (Nullable<_> 51.0M) @@>, box '3' + + <@@ Nullable.single (Nullable<_> 3uy) @@>, box 3f + <@@ Nullable.single (Nullable<_> 3y) @@>, box 3f + <@@ Nullable.single (Nullable<_> 3s) @@>, box 3f + <@@ Nullable.single (Nullable<_> 3us) @@>, box 3f + <@@ Nullable.single (Nullable<_> 3) @@>, box 3f + <@@ Nullable.single (Nullable<_> 3u) @@>, box 3f + <@@ Nullable.single (Nullable<_> 3L) @@>, box 3f + <@@ Nullable.single (Nullable<_> 3UL) @@>, box 3f + <@@ Nullable.single (Nullable<_> '\003') @@>, box 3f + <@@ Nullable.single (Nullable<_> 3.0f) @@>, box 3f + <@@ Nullable.single (Nullable<_> 3.0) @@>, box 3f + <@@ Nullable.single (Nullable<_> 3.0) @@>, box 3f + <@@ Nullable.single (Nullable<_> 3I) @@>, box 3f + <@@ Nullable.single (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1f + <@@ Nullable.single (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1f + <@@ Nullable.single (Nullable<_> 3.0M) @@>, box 3f + <@@ Nullable.float32 (Nullable<_> 3uy) @@>, box 3f + <@@ Nullable.float32 (Nullable<_> 3y) @@>, box 3f + <@@ Nullable.float32 (Nullable<_> 3s) @@>, box 3f + <@@ Nullable.float32 (Nullable<_> 3us) @@>, box 3f + <@@ Nullable.float32 (Nullable<_> 3) @@>, box 3f + <@@ Nullable.float32 (Nullable<_> 3u) @@>, box 3f + <@@ Nullable.float32 (Nullable<_> 3L) @@>, box 3f + <@@ Nullable.float32 (Nullable<_> 3UL) @@>, box 3f + <@@ Nullable.float32 (Nullable<_> '\003') @@>, box 3f + <@@ Nullable.float32 (Nullable<_> 3.0f) @@>, box 3f + <@@ Nullable.float32 (Nullable<_> 3.0) @@>, box 3f + <@@ Nullable.float32 (Nullable<_> 3.0) @@>, box 3f + <@@ Nullable.float32 (Nullable<_> 3I) @@>, box 3f + <@@ Nullable.float32 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1f + <@@ Nullable.float32 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1f + <@@ Nullable.float32 (Nullable<_> 3.0M) @@>, box 3f + + <@@ Nullable.double (Nullable<_> 3uy) @@>, box 3. + <@@ Nullable.double (Nullable<_> 3y) @@>, box 3. + <@@ Nullable.double (Nullable<_> 3s) @@>, box 3. + <@@ Nullable.double (Nullable<_> 3us) @@>, box 3. + <@@ Nullable.double (Nullable<_> 3) @@>, box 3. + <@@ Nullable.double (Nullable<_> 3u) @@>, box 3. + <@@ Nullable.double (Nullable<_> 3L) @@>, box 3. + <@@ Nullable.double (Nullable<_> 3UL) @@>, box 3. + <@@ Nullable.double (Nullable<_> '\003') @@>, box 3. + <@@ Nullable.double (Nullable<_> 3.0f) @@>, box 3. + <@@ Nullable.double (Nullable<_> 3.0) @@>, box 3. + <@@ Nullable.double (Nullable<_> 3.0) @@>, box 3. + <@@ Nullable.double (Nullable<_> 3I) @@>, box 3. + <@@ Nullable.double (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1. + <@@ Nullable.double (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1. + <@@ Nullable.double (Nullable<_> 3.0M) @@>, box 3. + <@@ Nullable.float (Nullable<_> 3uy) @@>, box 3. + <@@ Nullable.float (Nullable<_> 3y) @@>, box 3. + <@@ Nullable.float (Nullable<_> 3s) @@>, box 3. + <@@ Nullable.float (Nullable<_> 3us) @@>, box 3. + <@@ Nullable.float (Nullable<_> 3) @@>, box 3. + <@@ Nullable.float (Nullable<_> 3u) @@>, box 3. + <@@ Nullable.float (Nullable<_> 3L) @@>, box 3. + <@@ Nullable.float (Nullable<_> 3UL) @@>, box 3. + <@@ Nullable.float (Nullable<_> '\003') @@>, box 3. + <@@ Nullable.float (Nullable<_> 3.0f) @@>, box 3. + <@@ Nullable.float (Nullable<_> 3.0) @@>, box 3. + <@@ Nullable.float (Nullable<_> 3.0) @@>, box 3. + <@@ Nullable.float (Nullable<_> 3I) @@>, box 3. + <@@ Nullable.float (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1. + <@@ Nullable.float (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1. + <@@ Nullable.float (Nullable<_> 3.0M) @@>, box 3. + + <@@ Nullable.decimal (Nullable<_> 3uy) @@>, box 3m + <@@ Nullable.decimal (Nullable<_> 3y) @@>, box 3m + <@@ Nullable.decimal (Nullable<_> 3s) @@>, box 3m + <@@ Nullable.decimal (Nullable<_> 3us) @@>, box 3m + <@@ Nullable.decimal (Nullable<_> 3) @@>, box 3m + <@@ Nullable.decimal (Nullable<_> 3u) @@>, box 3m + <@@ Nullable.decimal (Nullable<_> 3L) @@>, box 3m + <@@ Nullable.decimal (Nullable<_> 3UL) @@>, box 3m + <@@ Nullable.decimal (Nullable<_> '\003') @@>, box 3m + <@@ Nullable.decimal (Nullable<_> 3.0f) @@>, box 3m + <@@ Nullable.decimal (Nullable<_> 3.0) @@>, box 3m + <@@ Nullable.decimal (Nullable<_> 3.0) @@>, box 3m + <@@ Nullable.decimal (Nullable<_> 3I) @@>, box 3m + <@@ Nullable.decimal (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1m + <@@ Nullable.decimal (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1m + <@@ Nullable.decimal (Nullable<_> 3.0M) @@>, box 3m + + <@@ Nullable<_> 1y ?+ 4y @@>, box 5y + <@@ Nullable<_> 1uy ?+ 4uy @@>, box 5uy + <@@ Nullable<_> 1s ?+ 4s @@>, box 5s + <@@ Nullable<_> 1us ?+ 4us @@>, box 5us + <@@ Nullable<_> 1 ?+ 4 @@>, box 5 + <@@ Nullable<_> 1u ?+ 4u @@>, box 5u + <@@ Nullable<_> 1L ?+ 4L @@>, box 5L + <@@ Nullable<_> 1uL ?+ 4uL @@>, box 5uL + <@@ Nullable<_> 1.0f ?+ 4.0f @@>, box 5f + <@@ Nullable<_> 1.0 ?+ 4.0 @@>, box 5. + <@@ Nullable<_> 1m ?+ 4m @@>, box 5m + <@@ Nullable<_> 1m ?+ 4m @@>, box 5m + <@@ Nullable<_> 1I ?+ 4I @@>, box 5I + <@@ Nullable<_> '1' ?+ '\004' @@>, box '5' + <@@ Nullable<_> LanguagePrimitives.GenericOne ?+ LanguagePrimitives.GenericOne @@>, box 2n + <@@ Nullable<_> LanguagePrimitives.GenericOne ?+ LanguagePrimitives.GenericOne @@>, box 2un + + <@@ 1y +? Nullable<_> 4y @@>, box 5y + <@@ 1uy +? Nullable<_> 4uy @@>, box 5uy + <@@ 1s +? Nullable<_> 4s @@>, box 5s + <@@ 1us +? Nullable<_> 4us @@>, box 5us + <@@ 1 +? Nullable<_> 4 @@>, box 5 + <@@ 1u +? Nullable<_> 4u @@>, box 5u + <@@ 1L +? Nullable<_> 4L @@>, box 5L + <@@ 1uL +? Nullable<_> 4uL @@>, box 5uL + <@@ 1.0f +? Nullable<_> 4.0f @@>, box 5f + <@@ 1.0 +? Nullable<_> 4.0 @@>, box 5. + <@@ 1m +? Nullable<_> 4m @@>, box 5m + <@@ 1m +? Nullable<_> 4m @@>, box 5m + <@@ 1I +? Nullable<_> 4I @@>, box 5I + <@@ '1' +? Nullable<_> '\004' @@>, box '5' + <@@ LanguagePrimitives.GenericOne +? Nullable<_> LanguagePrimitives.GenericOne @@>, box 2n + <@@ LanguagePrimitives.GenericOne +? Nullable<_> LanguagePrimitives.GenericOne @@>, box 2un + + <@@ Nullable<_> 1y ?+? Nullable<_> 4y @@>, box 5y + <@@ Nullable<_> 1uy ?+? Nullable<_> 4uy @@>, box 5uy + <@@ Nullable<_> 1s ?+? Nullable<_> 4s @@>, box 5s + <@@ Nullable<_> 1us ?+? Nullable<_> 4us @@>, box 5us + <@@ Nullable<_> 1 ?+? Nullable<_> 4 @@>, box 5 + <@@ Nullable<_> 1u ?+? Nullable<_> 4u @@>, box 5u + <@@ Nullable<_> 1L ?+? Nullable<_> 4L @@>, box 5L + <@@ Nullable<_> 1uL ?+? Nullable<_> 4uL @@>, box 5uL + <@@ Nullable<_> 1.0f ?+? Nullable<_> 4.0f @@>, box 5f + <@@ Nullable<_> 1.0 ?+? Nullable<_> 4.0 @@>, box 5. + <@@ Nullable<_> 1m ?+? Nullable<_> 4m @@>, box 5m + <@@ Nullable<_> 1m ?+? Nullable<_> 4m @@>, box 5m + <@@ Nullable<_> 1I ?+? Nullable<_> 4I @@>, box 5I + <@@ Nullable<_> '1' ?+? Nullable<_> '\004' @@>, box '5' + <@@ Nullable<_> LanguagePrimitives.GenericOne ?+? Nullable<_> LanguagePrimitives.GenericOne @@>, box 2n + <@@ Nullable<_> LanguagePrimitives.GenericOne ?+? Nullable<_> LanguagePrimitives.GenericOne @@>, box 2un + + <@@ Nullable<_> 4y ?- 1y @@>, box 3y + <@@ Nullable<_> 4uy ?- 1uy @@>, box 3uy + <@@ Nullable<_> 4s ?- 1s @@>, box 3s + <@@ Nullable<_> 4us ?- 1us @@>, box 3us + <@@ Nullable<_> 4 ?- 1 @@>, box 3 + <@@ Nullable<_> 4u ?- 1u @@>, box 3u + <@@ Nullable<_> 4L ?- 1L @@>, box 3L + <@@ Nullable<_> 4uL ?- 1uL @@>, box 3uL + <@@ Nullable<_> 4.0f ?- 1.0f @@>, box 3f + <@@ Nullable<_> 4.0 ?- 1.0 @@>, box 3. + <@@ Nullable<_> 4m ?- 1m @@>, box 3m + <@@ Nullable<_> 4m ?- 1m @@>, box 3m + <@@ Nullable<_> 4I ?- 1I @@>, box 3I + <@@ Nullable<_> '4' ?- '\001' @@>, box '3' + <@@ Nullable<_> LanguagePrimitives.GenericOne ?- LanguagePrimitives.GenericOne @@>, box 0n + <@@ Nullable<_> LanguagePrimitives.GenericOne ?- LanguagePrimitives.GenericOne @@>, box 0un + + <@@ 4y -? Nullable<_> 1y @@>, box 3y + <@@ 4uy -? Nullable<_> 1uy @@>, box 3uy + <@@ 4s -? Nullable<_> 1s @@>, box 3s + <@@ 4us -? Nullable<_> 1us @@>, box 3us + <@@ 4 -? Nullable<_> 1 @@>, box 3 + <@@ 4u -? Nullable<_> 1u @@>, box 3u + <@@ 4L -? Nullable<_> 1L @@>, box 3L + <@@ 4uL -? Nullable<_> 1uL @@>, box 3uL + <@@ 4.0f -? Nullable<_> 1.0f @@>, box 3f + <@@ 4.0 -? Nullable<_> 1.0 @@>, box 3. + <@@ 4m -? Nullable<_> 1m @@>, box 3m + <@@ 4m -? Nullable<_> 1m @@>, box 3m + <@@ 4I -? Nullable<_> 1I @@>, box 3I + <@@ '4' -? Nullable<_> '\001' @@>, box '3' + <@@ LanguagePrimitives.GenericOne -? Nullable<_> LanguagePrimitives.GenericOne @@>, box 0n + <@@ LanguagePrimitives.GenericOne -? Nullable<_> LanguagePrimitives.GenericOne @@>, box 0un + + <@@ Nullable<_> 4y ?-? Nullable<_> 1y @@>, box 3y + <@@ Nullable<_> 4uy ?-? Nullable<_> 1uy @@>, box 3uy + <@@ Nullable<_> 4s ?-? Nullable<_> 1s @@>, box 3s + <@@ Nullable<_> 4us ?-? Nullable<_> 1us @@>, box 3us + <@@ Nullable<_> 4 ?-? Nullable<_> 1 @@>, box 3 + <@@ Nullable<_> 4u ?-? Nullable<_> 1u @@>, box 3u + <@@ Nullable<_> 4L ?-? Nullable<_> 1L @@>, box 3L + <@@ Nullable<_> 4uL ?-? Nullable<_> 1uL @@>, box 3uL + <@@ Nullable<_> 4.0f ?-? Nullable<_> 1.0f @@>, box 3f + <@@ Nullable<_> 4.0 ?-? Nullable<_> 1.0 @@>, box 3. + <@@ Nullable<_> 4m ?-? Nullable<_> 1m @@>, box 3m + <@@ Nullable<_> 4m ?-? Nullable<_> 1m @@>, box 3m + <@@ Nullable<_> 4I ?-? Nullable<_> 1I @@>, box 3I + <@@ Nullable<_> '4' ?-? Nullable<_> '\001' @@>, box '3' + <@@ Nullable<_> LanguagePrimitives.GenericOne ?-? Nullable<_> LanguagePrimitives.GenericOne @@>, box 0n + <@@ Nullable<_> LanguagePrimitives.GenericOne ?-? Nullable<_> LanguagePrimitives.GenericOne @@>, box 0un + + <@@ Nullable<_> 2y ?* 4y @@>, box 8y + <@@ Nullable<_> 2uy ?* 4uy @@>, box 8uy + <@@ Nullable<_> 2s ?* 4s @@>, box 8s + <@@ Nullable<_> 2us ?* 4us @@>, box 8us + <@@ Nullable<_> 2 ?* 4 @@>, box 8 + <@@ Nullable<_> 2u ?* 4u @@>, box 8u + <@@ Nullable<_> 2L ?* 4L @@>, box 8L + <@@ Nullable<_> 2uL ?* 4uL @@>, box 8uL + <@@ Nullable<_> 2.0f ?* 4.0f @@>, box 8f + <@@ Nullable<_> 2.0 ?* 4.0 @@>, box 8. + <@@ Nullable<_> 2m ?* 4m @@>, box 8m + <@@ Nullable<_> 2m ?* 4m @@>, box 8m + <@@ Nullable<_> 2I ?* 4I @@>, box 8I + <@@ Nullable<_> LanguagePrimitives.GenericOne ?* LanguagePrimitives.GenericOne @@>, box 1n + <@@ Nullable<_> LanguagePrimitives.GenericOne ?* LanguagePrimitives.GenericOne @@>, box 1un + + <@@ 2y *? Nullable<_> 4y @@>, box 8y + <@@ 2uy *? Nullable<_> 4uy @@>, box 8uy + <@@ 2s *? Nullable<_> 4s @@>, box 8s + <@@ 2us *? Nullable<_> 4us @@>, box 8us + <@@ 2 *? Nullable<_> 4 @@>, box 8 + <@@ 2u *? Nullable<_> 4u @@>, box 8u + <@@ 2L *? Nullable<_> 4L @@>, box 8L + <@@ 2uL *? Nullable<_> 4uL @@>, box 8uL + <@@ 2.0f *? Nullable<_> 4.0f @@>, box 8f + <@@ 2.0 *? Nullable<_> 4.0 @@>, box 8. + <@@ 2m *? Nullable<_> 4m @@>, box 8m + <@@ 2m *? Nullable<_> 4m @@>, box 8m + <@@ 2I *? Nullable<_> 4I @@>, box 8I + <@@ LanguagePrimitives.GenericOne *? Nullable<_> LanguagePrimitives.GenericOne @@>, box 1n + <@@ LanguagePrimitives.GenericOne *? Nullable<_> LanguagePrimitives.GenericOne @@>, box 1un + + <@@ Nullable<_> 2y ?*? Nullable<_> 4y @@>, box 8y + <@@ Nullable<_> 2uy ?*? Nullable<_> 4uy @@>, box 8uy + <@@ Nullable<_> 2s ?*? Nullable<_> 4s @@>, box 8s + <@@ Nullable<_> 2us ?*? Nullable<_> 4us @@>, box 8us + <@@ Nullable<_> 2 ?*? Nullable<_> 4 @@>, box 8 + <@@ Nullable<_> 2u ?*? Nullable<_> 4u @@>, box 8u + <@@ Nullable<_> 2L ?*? Nullable<_> 4L @@>, box 8L + <@@ Nullable<_> 2uL ?*? Nullable<_> 4uL @@>, box 8uL + <@@ Nullable<_> 2.0f ?*? Nullable<_> 4.0f @@>, box 8f + <@@ Nullable<_> 2.0 ?*? Nullable<_> 4.0 @@>, box 8. + <@@ Nullable<_> 2m ?*? Nullable<_> 4m @@>, box 8m + <@@ Nullable<_> 2m ?*? Nullable<_> 4m @@>, box 8m + <@@ Nullable<_> 2I ?*? Nullable<_> 4I @@>, box 8I + <@@ Nullable<_> LanguagePrimitives.GenericOne ?*? Nullable<_> LanguagePrimitives.GenericOne @@>, box 1n + <@@ Nullable<_> LanguagePrimitives.GenericOne ?*? Nullable<_> LanguagePrimitives.GenericOne @@>, box 1un + + <@@ Nullable<_> 6y ?/ 3y @@>, box 2y + <@@ Nullable<_> 6uy ?/ 3uy @@>, box 2uy + <@@ Nullable<_> 6s ?/ 3s @@>, box 2s + <@@ Nullable<_> 6us ?/ 3us @@>, box 2us + <@@ Nullable<_> 6 ?/ 3 @@>, box 2 + <@@ Nullable<_> 6u ?/ 3u @@>, box 2u + <@@ Nullable<_> 6L ?/ 3L @@>, box 2L + <@@ Nullable<_> 6uL ?/ 3uL @@>, box 2uL + <@@ Nullable<_> 6.0f ?/ 3.0f @@>, box 2f + <@@ Nullable<_> 6.0 ?/ 3.0 @@>, box 2. + <@@ Nullable<_> 6m ?/ 3m @@>, box 2m + <@@ Nullable<_> 6m ?/ 3m @@>, box 2m + <@@ Nullable<_> 6I ?/ 3I @@>, box 2I + <@@ Nullable<_> LanguagePrimitives.GenericOne ?/ LanguagePrimitives.GenericOne @@>, box 1n + <@@ Nullable<_> LanguagePrimitives.GenericOne ?/ LanguagePrimitives.GenericOne @@>, box 1un + + <@@ 6y /? Nullable<_> 3y @@>, box 2y + <@@ 6uy /? Nullable<_> 3uy @@>, box 2uy + <@@ 6s /? Nullable<_> 3s @@>, box 2s + <@@ 6us /? Nullable<_> 3us @@>, box 2us + <@@ 6 /? Nullable<_> 3 @@>, box 2 + <@@ 6u /? Nullable<_> 3u @@>, box 2u + <@@ 6L /? Nullable<_> 3L @@>, box 2L + <@@ 6uL /? Nullable<_> 3uL @@>, box 2uL + <@@ 6.0f /? Nullable<_> 3.0f @@>, box 2f + <@@ 6.0 /? Nullable<_> 3.0 @@>, box 2. + <@@ 6m /? Nullable<_> 3m @@>, box 2m + <@@ 6m /? Nullable<_> 3m @@>, box 2m + <@@ 6I /? Nullable<_> 3I @@>, box 2I + <@@ LanguagePrimitives.GenericOne /? Nullable<_> LanguagePrimitives.GenericOne @@>, box 1n + <@@ LanguagePrimitives.GenericOne /? Nullable<_> LanguagePrimitives.GenericOne @@>, box 1un + + <@@ Nullable<_> 6y ?/? Nullable<_> 3y @@>, box 2y + <@@ Nullable<_> 6uy ?/? Nullable<_> 3uy @@>, box 2uy + <@@ Nullable<_> 6s ?/? Nullable<_> 3s @@>, box 2s + <@@ Nullable<_> 6us ?/? Nullable<_> 3us @@>, box 2us + <@@ Nullable<_> 6 ?/? Nullable<_> 3 @@>, box 2 + <@@ Nullable<_> 6u ?/? Nullable<_> 3u @@>, box 2u + <@@ Nullable<_> 6L ?/? Nullable<_> 3L @@>, box 2L + <@@ Nullable<_> 6uL ?/? Nullable<_> 3uL @@>, box 2uL + <@@ Nullable<_> 6.0f ?/? Nullable<_> 3.0f @@>, box 2f + <@@ Nullable<_> 6.0 ?/? Nullable<_> 3.0 @@>, box 2. + <@@ Nullable<_> 6m ?/? Nullable<_> 3m @@>, box 2m + <@@ Nullable<_> 6m ?/? Nullable<_> 3m @@>, box 2m + <@@ Nullable<_> 6I ?/? Nullable<_> 3I @@>, box 2I + <@@ Nullable<_> LanguagePrimitives.GenericOne ?/? Nullable<_> LanguagePrimitives.GenericOne @@>, box 1n + <@@ Nullable<_> LanguagePrimitives.GenericOne ?/? Nullable<_> LanguagePrimitives.GenericOne @@>, box 1un + + <@@ Nullable<_> 9y ?% 4y @@>, box 1y + <@@ Nullable<_> 9uy ?% 4uy @@>, box 1uy + <@@ Nullable<_> 9s ?% 4s @@>, box 1s + <@@ Nullable<_> 9us ?% 4us @@>, box 1us + <@@ Nullable<_> 9 ?% 4 @@>, box 1 + <@@ Nullable<_> 9u ?% 4u @@>, box 1u + <@@ Nullable<_> 9L ?% 4L @@>, box 1L + <@@ Nullable<_> 9uL ?% 4uL @@>, box 1uL + <@@ Nullable<_> 9.0f ?% 4.0f @@>, box 1f + <@@ Nullable<_> 9.0 ?% 4.0 @@>, box 1. + <@@ Nullable<_> 9m ?% 4m @@>, box 1m + <@@ Nullable<_> 9m ?% 4m @@>, box 1m + <@@ Nullable<_> 9I ?% 4I @@>, box 1I + <@@ Nullable<_> LanguagePrimitives.GenericOne ?% LanguagePrimitives.GenericOne @@>, box 0n + <@@ Nullable<_> LanguagePrimitives.GenericOne ?% LanguagePrimitives.GenericOne @@>, box 0un + + <@@ 9y %? Nullable<_> 4y @@>, box 1y + <@@ 9uy %? Nullable<_> 4uy @@>, box 1uy + <@@ 9s %? Nullable<_> 4s @@>, box 1s + <@@ 9us %? Nullable<_> 4us @@>, box 1us + <@@ 9 %? Nullable<_> 4 @@>, box 1 + <@@ 9u %? Nullable<_> 4u @@>, box 1u + <@@ 9L %? Nullable<_> 4L @@>, box 1L + <@@ 9uL %? Nullable<_> 4uL @@>, box 1uL + <@@ 9.0f %? Nullable<_> 4.0f @@>, box 1f + <@@ 9.0 %? Nullable<_> 4.0 @@>, box 1. + <@@ 9m %? Nullable<_> 4m @@>, box 1m + <@@ 9m %? Nullable<_> 4m @@>, box 1m + <@@ 9I %? Nullable<_> 4I @@>, box 1I + <@@ LanguagePrimitives.GenericOne %? Nullable<_> LanguagePrimitives.GenericOne @@>, box 0n + <@@ LanguagePrimitives.GenericOne %? Nullable<_> LanguagePrimitives.GenericOne @@>, box 0un + + <@@ Nullable<_> 9y ?%? Nullable<_> 4y @@>, box 1y + <@@ Nullable<_> 9uy ?%? Nullable<_> 4uy @@>, box 1uy + <@@ Nullable<_> 9s ?%? Nullable<_> 4s @@>, box 1s + <@@ Nullable<_> 9us ?%? Nullable<_> 4us @@>, box 1us + <@@ Nullable<_> 9 ?%? Nullable<_> 4 @@>, box 1 + <@@ Nullable<_> 9u ?%? Nullable<_> 4u @@>, box 1u + <@@ Nullable<_> 9L ?%? Nullable<_> 4L @@>, box 1L + <@@ Nullable<_> 9uL ?%? Nullable<_> 4uL @@>, box 1uL + <@@ Nullable<_> 9.0f ?%? Nullable<_> 4.0f @@>, box 1f + <@@ Nullable<_> 9.0 ?%? Nullable<_> 4.0 @@>, box 1. + <@@ Nullable<_> 9m ?%? Nullable<_> 4m @@>, box 1m + <@@ Nullable<_> 9m ?%? Nullable<_> 4m @@>, box 1m + <@@ Nullable<_> 9I ?%? Nullable<_> 4I @@>, box 1I + <@@ Nullable<_> LanguagePrimitives.GenericOne ?%? Nullable<_> LanguagePrimitives.GenericOne @@>, box 0n + <@@ Nullable<_> LanguagePrimitives.GenericOne ?%? Nullable<_> LanguagePrimitives.GenericOne @@>, box 0un + + <@@ NonStructuralComparison.(=) 3y 3y @@>, box true + <@@ NonStructuralComparison.(=) 3uy 3uy @@>, box true + <@@ NonStructuralComparison.(=) 3s 3s @@>, box true + <@@ NonStructuralComparison.(=) 3us 3us @@>, box true + <@@ NonStructuralComparison.(=) 3 3 @@>, box true + <@@ NonStructuralComparison.(=) 3u 3u @@>, box true + <@@ NonStructuralComparison.(=) 3L 3L @@>, box true + <@@ NonStructuralComparison.(=) 3UL 3UL @@>, box true + <@@ NonStructuralComparison.(=) '3' '3' @@>, box true + <@@ NonStructuralComparison.(=) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box true + <@@ NonStructuralComparison.(=) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box true + <@@ NonStructuralComparison.(=) 3f 3f @@>, box true + <@@ NonStructuralComparison.(=) 3. 3. @@>, box true + <@@ NonStructuralComparison.(=) 3m 3m @@>, box true + <@@ NonStructuralComparison.(=) 3m 3m @@>, box true + <@@ NonStructuralComparison.(=) 3I 3I @@>, box true + <@@ NonStructuralComparison.(=) "3" "3" @@>, box true + + <@@ NonStructuralComparison.(<>) 3y 3y @@>, box false + <@@ NonStructuralComparison.(<>) 3uy 3uy @@>, box false + <@@ NonStructuralComparison.(<>) 3s 3s @@>, box false + <@@ NonStructuralComparison.(<>) 3us 3us @@>, box false + <@@ NonStructuralComparison.(<>) 3 3 @@>, box false + <@@ NonStructuralComparison.(<>) 3u 3u @@>, box false + <@@ NonStructuralComparison.(<>) 3L 3L @@>, box false + <@@ NonStructuralComparison.(<>) 3UL 3UL @@>, box false + <@@ NonStructuralComparison.(<>) '3' '3' @@>, box false + <@@ NonStructuralComparison.(<>) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box false + <@@ NonStructuralComparison.(<>) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box false + <@@ NonStructuralComparison.(<>) 3f 3f @@>, box false + <@@ NonStructuralComparison.(<>) 3. 3. @@>, box false + <@@ NonStructuralComparison.(<>) 3m 3m @@>, box false + <@@ NonStructuralComparison.(<>) 3m 3m @@>, box false + <@@ NonStructuralComparison.(<>) 3I 3I @@>, box false + <@@ NonStructuralComparison.(<>) "3" "3" @@>, box false + + <@@ NonStructuralComparison.(<=) 3y 3y @@>, box true + <@@ NonStructuralComparison.(<=) 3uy 3uy @@>, box true + <@@ NonStructuralComparison.(<=) 3s 3s @@>, box true + <@@ NonStructuralComparison.(<=) 3us 3us @@>, box true + <@@ NonStructuralComparison.(<=) 3 3 @@>, box true + <@@ NonStructuralComparison.(<=) 3u 3u @@>, box true + <@@ NonStructuralComparison.(<=) 3L 3L @@>, box true + <@@ NonStructuralComparison.(<=) 3UL 3UL @@>, box true + <@@ NonStructuralComparison.(<=) '3' '3' @@>, box true + <@@ NonStructuralComparison.(<=) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box true + <@@ NonStructuralComparison.(<=) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box true + <@@ NonStructuralComparison.(<=) 3f 3f @@>, box true + <@@ NonStructuralComparison.(<=) 3. 3. @@>, box true + <@@ NonStructuralComparison.(<=) 3m 3m @@>, box true + <@@ NonStructuralComparison.(<=) 3m 3m @@>, box true + <@@ NonStructuralComparison.(<=) 3I 3I @@>, box true + <@@ NonStructuralComparison.(<=) "3" "3" @@>, box true + + <@@ NonStructuralComparison.(<) 3y 3y @@>, box false + <@@ NonStructuralComparison.(<) 3uy 3uy @@>, box false + <@@ NonStructuralComparison.(<) 3s 3s @@>, box false + <@@ NonStructuralComparison.(<) 3us 3us @@>, box false + <@@ NonStructuralComparison.(<) 3 3 @@>, box false + <@@ NonStructuralComparison.(<) 3u 3u @@>, box false + <@@ NonStructuralComparison.(<) 3L 3L @@>, box false + <@@ NonStructuralComparison.(<) 3UL 3UL @@>, box false + <@@ NonStructuralComparison.(<) '3' '3' @@>, box false + <@@ NonStructuralComparison.(<) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box false + <@@ NonStructuralComparison.(<) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box false + <@@ NonStructuralComparison.(<) 3f 3f @@>, box false + <@@ NonStructuralComparison.(<) 3. 3. @@>, box false + <@@ NonStructuralComparison.(<) 3m 3m @@>, box false + <@@ NonStructuralComparison.(<) 3m 3m @@>, box false + <@@ NonStructuralComparison.(<) 3I 3I @@>, box false + <@@ NonStructuralComparison.(<) "3" "3" @@>, box false + + <@@ NonStructuralComparison.(>=) 3y 3y @@>, box true + <@@ NonStructuralComparison.(>=) 3uy 3uy @@>, box true + <@@ NonStructuralComparison.(>=) 3s 3s @@>, box true + <@@ NonStructuralComparison.(>=) 3us 3us @@>, box true + <@@ NonStructuralComparison.(>=) 3 3 @@>, box true + <@@ NonStructuralComparison.(>=) 3u 3u @@>, box true + <@@ NonStructuralComparison.(>=) 3L 3L @@>, box true + <@@ NonStructuralComparison.(>=) 3UL 3UL @@>, box true + <@@ NonStructuralComparison.(>=) '3' '3' @@>, box true + <@@ NonStructuralComparison.(>=) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box true + <@@ NonStructuralComparison.(>=) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box true + <@@ NonStructuralComparison.(>=) 3f 3f @@>, box true + <@@ NonStructuralComparison.(>=) 3. 3. @@>, box true + <@@ NonStructuralComparison.(>=) 3m 3m @@>, box true + <@@ NonStructuralComparison.(>=) 3m 3m @@>, box true + <@@ NonStructuralComparison.(>=) 3I 3I @@>, box true + <@@ NonStructuralComparison.(>=) "3" "3" @@>, box true + + <@@ NonStructuralComparison.(>) 3y 3y @@>, box false + <@@ NonStructuralComparison.(>) 3uy 3uy @@>, box false + <@@ NonStructuralComparison.(>) 3s 3s @@>, box false + <@@ NonStructuralComparison.(>) 3us 3us @@>, box false + <@@ NonStructuralComparison.(>) 3 3 @@>, box false + <@@ NonStructuralComparison.(>) 3u 3u @@>, box false + <@@ NonStructuralComparison.(>) 3L 3L @@>, box false + <@@ NonStructuralComparison.(>) 3UL 3UL @@>, box false + <@@ NonStructuralComparison.(>) '3' '3' @@>, box false + <@@ NonStructuralComparison.(>) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box false + <@@ NonStructuralComparison.(>) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box false + <@@ NonStructuralComparison.(>) 3f 3f @@>, box false + <@@ NonStructuralComparison.(>) 3. 3. @@>, box false + <@@ NonStructuralComparison.(>) 3m 3m @@>, box false + <@@ NonStructuralComparison.(>) 3m 3m @@>, box false + <@@ NonStructuralComparison.(>) 3I 3I @@>, box false + <@@ NonStructuralComparison.(>) "3" "3" @@>, box false + |] + + tests |> Array.map (fun (test, eval) -> + begin + printfn "--> Checking we can evaluate %A" test + let res = FSharp.Linq.RuntimeHelpers.LeafExpressionConverter.EvaluateQuotation test + let b = res = eval + if b then printfn "--- Success, it is %A which is equal to %A" res eval + else printfn "!!! FAILURE, it is %A which is not equal to %A" res eval + b + end + && match test with - | CallWithWitnesses(None, minfo1, minfo2, witnessArgs, args) -> - minfo1.IsStatic && - minfo2.IsStatic && - minfo2.Name = minfo1.Name + "$W" && + | CallWithWitnesses(None, minfo1, minfo2, witnessArgs, args) -> + minfo1.IsStatic && + minfo2.IsStatic && + minfo2.Name = minfo1.Name + "$W" && (* - (printfn "checking minfo2.GetParameters().Length = %d..." (minfo2.GetParameters().Length); true) && - minfo2.GetParameters().Length = 3 && - (printfn "checking witnessArgs.Length..."; true) && - witnessArgs.Length = 1 && - (printfn "checking args.Length..."; true) && - args.Length = 2 && - (printfn "witnessArgs..."; true) && - (match witnessArgs with [ Lambda _ ] -> true | _ -> false) && - (printfn "args..."; true) && - (match args with [ _; _ ] -> true | _ -> false) - *) - true - | _ -> false)) + (printfn "checking minfo2.GetParameters().Length = %d..." (minfo2.GetParameters().Length); true) && + minfo2.GetParameters().Length = 3 && + (printfn "checking witnessArgs.Length..."; true) && + witnessArgs.Length = 1 && + (printfn "checking args.Length..."; true) && + args.Length = 2 && + (printfn "witnessArgs..."; true) && + (match witnessArgs with [ Lambda _ ] -> true | _ -> false) && + (printfn "args..."; true) && + (match args with [ _; _ ] -> true | _ -> false) + *) + (printfn "<-- Successfully checked with Quotations.Patterns.(|CallWithWitnesses|_|)"; true) + || (printfn "<-- FAILURE, failed after matching with Quotations.Patterns.(|CallWithWitnesses|_|)"; true) + | _ -> + printfn " Array.forall id) // Don't short circuit on a failed test + + test "check non-CallWithWitnesses operators" + (let tests = [| + <@@ LanguagePrimitives.PhysicalEquality [|3|] [|3|] @@>, box false + <@@ let x = [|3|] in LanguagePrimitives.PhysicalEquality x x @@>, box true + <@@ LanguagePrimitives.PhysicalEquality (seq { 3 }) (seq { 3 }) @@>, box false + <@@ let x = seq { 3 } in LanguagePrimitives.PhysicalEquality x x @@>, box true + <@@ LanguagePrimitives.PhysicalEquality (obj()) (obj()) @@>, box false + <@@ let x = obj() in LanguagePrimitives.PhysicalEquality x x @@>, box true + + <@@ 3y = 3y @@>, box true + <@@ 3uy = 3uy @@>, box true + <@@ 3s = 3s @@>, box true + <@@ 3us = 3us @@>, box true + <@@ 3 = 3 @@>, box true + <@@ 3u = 3u @@>, box true + <@@ 3L = 3L @@>, box true + <@@ 3UL = 3UL @@>, box true + <@@ '3' = '3' @@>, box true + <@@ LanguagePrimitives.GenericOne = LanguagePrimitives.GenericOne @@>, box true + <@@ LanguagePrimitives.GenericOne = LanguagePrimitives.GenericOne @@>, box true + <@@ 3f = 3f @@>, box true + <@@ 3. = 3. @@>, box true + <@@ 3m = 3m @@>, box true + <@@ 3m = 3m @@>, box true + <@@ 3I = 3I @@>, box true + <@@ "3" = "3" @@>, box true + <@@ [3] = [3] @@>, box true + <@@ [|3|] = [|3|] @@>, box true + <@@ seq { 3 } = seq { 3 } @@>, box false // Reference equality + <@@ let x = seq { 3 } in x = x @@>, box true + <@@ obj() = obj() @@>, box false + <@@ let x = obj() in x = x @@>, box true + + <@@ 3y <> 3y @@>, box false + <@@ 3uy <> 3uy @@>, box false + <@@ 3s <> 3s @@>, box false + <@@ 3us <> 3us @@>, box false + <@@ 3 <> 3 @@>, box false + <@@ 3u <> 3u @@>, box false + <@@ 3L <> 3L @@>, box false + <@@ 3UL <> 3UL @@>, box false + <@@ '3' <> '3' @@>, box false + <@@ LanguagePrimitives.GenericOne <> LanguagePrimitives.GenericOne @@>, box false + <@@ LanguagePrimitives.GenericOne <> LanguagePrimitives.GenericOne @@>, box false + <@@ 3f <> 3f @@>, box false + <@@ 3. <> 3. @@>, box false + <@@ 3m <> 3m @@>, box false + <@@ 3m <> 3m @@>, box false + <@@ 3I <> 3I @@>, box false + <@@ "3" <> "3" @@>, box false + <@@ [3] <> [3] @@>, box false + <@@ [|3|] <> [|3|] @@>, box false + <@@ seq { 3 } <> seq { 3 } @@>, box true // Reference equality + <@@ let x = seq { 3 } in x <> x @@>, box false + <@@ obj() <> obj() @@>, box true + <@@ let x = obj() in x <> x @@>, box false + + <@@ 3y <= 3y @@>, box true + <@@ 3uy <= 3uy @@>, box true + <@@ 3s <= 3s @@>, box true + <@@ 3us <= 3us @@>, box true + <@@ 3 <= 3 @@>, box true + <@@ 3u <= 3u @@>, box true + <@@ 3L <= 3L @@>, box true + <@@ 3UL <= 3UL @@>, box true + <@@ '3' <= '3' @@>, box true + <@@ LanguagePrimitives.GenericOne <= LanguagePrimitives.GenericOne @@>, box true + <@@ LanguagePrimitives.GenericOne <= LanguagePrimitives.GenericOne @@>, box true + <@@ 3f <= 3f @@>, box true + <@@ 3. <= 3. @@>, box true + <@@ 3m <= 3m @@>, box true + <@@ 3m <= 3m @@>, box true + <@@ 3I <= 3I @@>, box true + <@@ "3" <= "3" @@>, box true + <@@ [3] <= [3] @@>, box true + <@@ [|3|] <= [|3|] @@>, box true + + <@@ 3y < 3y @@>, box false + <@@ 3uy < 3uy @@>, box false + <@@ 3s < 3s @@>, box false + <@@ 3us < 3us @@>, box false + <@@ 3 < 3 @@>, box false + <@@ 3u < 3u @@>, box false + <@@ 3L < 3L @@>, box false + <@@ 3UL < 3UL @@>, box false + <@@ '3' < '3' @@>, box false + <@@ LanguagePrimitives.GenericOne < LanguagePrimitives.GenericOne @@>, box false + <@@ LanguagePrimitives.GenericOne < LanguagePrimitives.GenericOne @@>, box false + <@@ 3f < 3f @@>, box false + <@@ 3. < 3. @@>, box false + <@@ 3m < 3m @@>, box false + <@@ 3m < 3m @@>, box false + <@@ 3I < 3I @@>, box false + <@@ "3" < "3" @@>, box false + <@@ [3] < [3] @@>, box false + <@@ [|3|] < [|3|] @@>, box false + + <@@ 3y >= 3y @@>, box true + <@@ 3uy >= 3uy @@>, box true + <@@ 3s >= 3s @@>, box true + <@@ 3us >= 3us @@>, box true + <@@ 3 >= 3 @@>, box true + <@@ 3u >= 3u @@>, box true + <@@ 3L >= 3L @@>, box true + <@@ 3UL >= 3UL @@>, box true + <@@ '3' >= '3' @@>, box true + <@@ LanguagePrimitives.GenericOne >= LanguagePrimitives.GenericOne @@>, box true + <@@ LanguagePrimitives.GenericOne >= LanguagePrimitives.GenericOne @@>, box true + <@@ 3f >= 3f @@>, box true + <@@ 3. >= 3. @@>, box true + <@@ 3m >= 3m @@>, box true + <@@ 3m >= 3m @@>, box true + <@@ 3I >= 3I @@>, box true + <@@ "3" >= "3" @@>, box true + <@@ [3] >= [3] @@>, box true + <@@ [|3|] >= [|3|] @@>, box true + + <@@ 3y > 3y @@>, box false + <@@ 3uy > 3uy @@>, box false + <@@ 3s > 3s @@>, box false + <@@ 3us > 3us @@>, box false + <@@ 3 > 3 @@>, box false + <@@ 3u > 3u @@>, box false + <@@ 3L > 3L @@>, box false + <@@ 3UL > 3UL @@>, box false + <@@ '3' > '3' @@>, box false + <@@ LanguagePrimitives.GenericOne > LanguagePrimitives.GenericOne @@>, box false + <@@ LanguagePrimitives.GenericOne > LanguagePrimitives.GenericOne @@>, box false + <@@ 3f > 3f @@>, box false + <@@ 3. > 3. @@>, box false + <@@ 3m > 3m @@>, box false + <@@ 3m > 3m @@>, box false + <@@ 3I > 3I @@>, box false + <@@ "3" > "3" @@>, box false + <@@ [3] > [3] @@>, box false + <@@ [|3|] > [|3|] @@>, box false + + <@@ Nullable<_> 1y ?= 1y @@>, box true + <@@ Nullable<_> 1uy ?= 1uy @@>, box true + <@@ Nullable<_> 1s ?= 1s @@>, box true + <@@ Nullable<_> 1us ?= 1us @@>, box true + <@@ Nullable<_> 1 ?= 1 @@>, box true + <@@ Nullable<_> 1u ?= 1u @@>, box true + <@@ Nullable<_> 1L ?= 1L @@>, box true + <@@ Nullable<_> 1uL ?= 1uL @@>, box true + <@@ Nullable<_> 1.0f ?= 1.0f @@>, box true + <@@ Nullable<_> 1.0 ?= 1.0 @@>, box true + <@@ Nullable<_> 1m ?= 1m @@>, box true + <@@ Nullable<_> 1m ?= 1m @@>, box true + <@@ Nullable<_> 1I ?= 1I @@>, box true + <@@ Nullable<_> '1' ?= '1' @@>, box true + <@@ Nullable<_> LanguagePrimitives.GenericOne ?= LanguagePrimitives.GenericOne @@>, box true + <@@ Nullable<_> LanguagePrimitives.GenericOne ?= LanguagePrimitives.GenericOne @@>, box true + + <@@ 1y =? Nullable<_> 1y @@>, box true + <@@ 1uy =? Nullable<_> 1uy @@>, box true + <@@ 1s =? Nullable<_> 1s @@>, box true + <@@ 1us =? Nullable<_> 1us @@>, box true + <@@ 1 =? Nullable<_> 1 @@>, box true + <@@ 1u =? Nullable<_> 1u @@>, box true + <@@ 1L =? Nullable<_> 1L @@>, box true + <@@ 1uL =? Nullable<_> 1uL @@>, box true + <@@ 1.0f =? Nullable<_> 1.0f @@>, box true + <@@ 1.0 =? Nullable<_> 1.0 @@>, box true + <@@ 1m =? Nullable<_> 1m @@>, box true + <@@ 1m =? Nullable<_> 1m @@>, box true + <@@ 1I =? Nullable<_> 1I @@>, box true + <@@ '1' =? Nullable<_> '1' @@>, box true + <@@ LanguagePrimitives.GenericOne =? Nullable<_> LanguagePrimitives.GenericOne @@>, box true + <@@ LanguagePrimitives.GenericOne =? Nullable<_> LanguagePrimitives.GenericOne @@>, box true + + <@@ Nullable<_> 1y ?=? Nullable<_> 1y @@>, box true + <@@ Nullable<_> 1uy ?=? Nullable<_> 1uy @@>, box true + <@@ Nullable<_> 1s ?=? Nullable<_> 1s @@>, box true + <@@ Nullable<_> 1us ?=? Nullable<_> 1us @@>, box true + <@@ Nullable<_> 1 ?=? Nullable<_> 1 @@>, box true + <@@ Nullable<_> 1u ?=? Nullable<_> 1u @@>, box true + <@@ Nullable<_> 1L ?=? Nullable<_> 1L @@>, box true + <@@ Nullable<_> 1uL ?=? Nullable<_> 1uL @@>, box true + <@@ Nullable<_> 1.0f ?=? Nullable<_> 1.0f @@>, box true + <@@ Nullable<_> 1.0 ?=? Nullable<_> 1.0 @@>, box true + <@@ Nullable<_> 1m ?=? Nullable<_> 1m @@>, box true + <@@ Nullable<_> 1m ?=? Nullable<_> 1m @@>, box true + <@@ Nullable<_> 1I ?=? Nullable<_> 1I @@>, box true + <@@ Nullable<_> '1' ?=? Nullable<_> '1' @@>, box true + <@@ Nullable<_> LanguagePrimitives.GenericOne ?=? Nullable<_> LanguagePrimitives.GenericOne @@>, box true + <@@ Nullable<_> LanguagePrimitives.GenericOne ?=? Nullable<_> LanguagePrimitives.GenericOne @@>, box true + + <@@ Nullable<_> 3y ?<> 3y @@>, box false + <@@ Nullable<_> 3uy ?<> 3uy @@>, box false + <@@ Nullable<_> 3s ?<> 3s @@>, box false + <@@ Nullable<_> 3us ?<> 3us @@>, box false + <@@ Nullable<_> 3 ?<> 3 @@>, box false + <@@ Nullable<_> 3u ?<> 3u @@>, box false + <@@ Nullable<_> 3L ?<> 3L @@>, box false + <@@ Nullable<_> 3UL ?<> 3UL @@>, box false + <@@ Nullable<_> '3' ?<> '3' @@>, box false + <@@ Nullable<_> LanguagePrimitives.GenericOne ?<> LanguagePrimitives.GenericOne @@>, box false + <@@ Nullable<_> LanguagePrimitives.GenericOne ?<> LanguagePrimitives.GenericOne @@>, box false + <@@ Nullable<_> 3f ?<> 3f @@>, box false + <@@ Nullable<_> 3. ?<> 3. @@>, box false + <@@ Nullable<_> 3m ?<> 3m @@>, box false + <@@ Nullable<_> 3m ?<> 3m @@>, box false + <@@ Nullable<_> 3I ?<> 3I @@>, box false + + <@@ 3y <>? Nullable<_> 3y @@>, box false + <@@ 3uy <>? Nullable<_> 3uy @@>, box false + <@@ 3s <>? Nullable<_> 3s @@>, box false + <@@ 3us <>? Nullable<_> 3us @@>, box false + <@@ 3 <>? Nullable<_> 3 @@>, box false + <@@ 3u <>? Nullable<_> 3u @@>, box false + <@@ 3L <>? Nullable<_> 3L @@>, box false + <@@ 3UL <>? Nullable<_> 3UL @@>, box false + <@@ '3' <>? Nullable<_> '3' @@>, box false + <@@ LanguagePrimitives.GenericOne <>? Nullable<_> LanguagePrimitives.GenericOne @@>, box false + <@@ LanguagePrimitives.GenericOne <>? Nullable<_> LanguagePrimitives.GenericOne @@>, box false + <@@ 3f <>? Nullable<_> 3f @@>, box false + <@@ 3. <>? Nullable<_> 3. @@>, box false + <@@ 3m <>? Nullable<_> 3m @@>, box false + <@@ 3m <>? Nullable<_> 3m @@>, box false + <@@ 3I <>? Nullable<_> 3I @@>, box false + + <@@ Nullable<_> 3y ?<>? Nullable<_> 3y @@>, box false + <@@ Nullable<_> 3uy ?<>? Nullable<_> 3uy @@>, box false + <@@ Nullable<_> 3s ?<>? Nullable<_> 3s @@>, box false + <@@ Nullable<_> 3us ?<>? Nullable<_> 3us @@>, box false + <@@ Nullable<_> 3 ?<>? Nullable<_> 3 @@>, box false + <@@ Nullable<_> 3u ?<>? Nullable<_> 3u @@>, box false + <@@ Nullable<_> 3L ?<>? Nullable<_> 3L @@>, box false + <@@ Nullable<_> 3UL ?<>? Nullable<_> 3UL @@>, box false + <@@ Nullable<_> '3' ?<>? Nullable<_> '3' @@>, box false + <@@ Nullable<_> LanguagePrimitives.GenericOne ?<>? Nullable<_> LanguagePrimitives.GenericOne @@>, box false + <@@ Nullable<_> LanguagePrimitives.GenericOne ?<>? Nullable<_> LanguagePrimitives.GenericOne @@>, box false + <@@ Nullable<_> 3f ?<>? Nullable<_> 3f @@>, box false + <@@ Nullable<_> 3. ?<>? Nullable<_> 3. @@>, box false + <@@ Nullable<_> 3m ?<>? Nullable<_> 3m @@>, box false + <@@ Nullable<_> 3m ?<>? Nullable<_> 3m @@>, box false + <@@ Nullable<_> 3I ?<>? Nullable<_> 3I @@>, box false + + <@@ Nullable<_> 3y ?<= 3y @@>, box true + <@@ Nullable<_> 3uy ?<= 3uy @@>, box true + <@@ Nullable<_> 3s ?<= 3s @@>, box true + <@@ Nullable<_> 3us ?<= 3us @@>, box true + <@@ Nullable<_> 3 ?<= 3 @@>, box true + <@@ Nullable<_> 3u ?<= 3u @@>, box true + <@@ Nullable<_> 3L ?<= 3L @@>, box true + <@@ Nullable<_> 3UL ?<= 3UL @@>, box true + <@@ Nullable<_> '3' ?<= '3' @@>, box true + <@@ Nullable<_> LanguagePrimitives.GenericOne ?<= LanguagePrimitives.GenericOne @@>, box true + <@@ Nullable<_> LanguagePrimitives.GenericOne ?<= LanguagePrimitives.GenericOne @@>, box true + <@@ Nullable<_> 3f ?<= 3f @@>, box true + <@@ Nullable<_> 3. ?<= 3. @@>, box true + <@@ Nullable<_> 3m ?<= 3m @@>, box true + <@@ Nullable<_> 3m ?<= 3m @@>, box true + <@@ Nullable<_> 3I ?<= 3I @@>, box true + + <@@ 3y <=? Nullable<_> 3y @@>, box true + <@@ 3uy <=? Nullable<_> 3uy @@>, box true + <@@ 3s <=? Nullable<_> 3s @@>, box true + <@@ 3us <=? Nullable<_> 3us @@>, box true + <@@ 3 <=? Nullable<_> 3 @@>, box true + <@@ 3u <=? Nullable<_> 3u @@>, box true + <@@ 3L <=? Nullable<_> 3L @@>, box true + <@@ 3UL <=? Nullable<_> 3UL @@>, box true + <@@ '3' <=? Nullable<_> '3' @@>, box true + <@@ LanguagePrimitives.GenericOne <=? Nullable<_> LanguagePrimitives.GenericOne @@>, box true + <@@ LanguagePrimitives.GenericOne <=? Nullable<_> LanguagePrimitives.GenericOne @@>, box true + <@@ 3f <=? Nullable<_> 3f @@>, box true + <@@ 3. <=? Nullable<_> 3. @@>, box true + <@@ 3m <=? Nullable<_> 3m @@>, box true + <@@ 3m <=? Nullable<_> 3m @@>, box true + <@@ 3I <=? Nullable<_> 3I @@>, box true + + <@@ Nullable<_> 3y ?<=? Nullable<_> 3y @@>, box true + <@@ Nullable<_> 3uy ?<=? Nullable<_> 3uy @@>, box true + <@@ Nullable<_> 3s ?<=? Nullable<_> 3s @@>, box true + <@@ Nullable<_> 3us ?<=? Nullable<_> 3us @@>, box true + <@@ Nullable<_> 3 ?<=? Nullable<_> 3 @@>, box true + <@@ Nullable<_> 3u ?<=? Nullable<_> 3u @@>, box true + <@@ Nullable<_> 3L ?<=? Nullable<_> 3L @@>, box true + <@@ Nullable<_> 3UL ?<=? Nullable<_> 3UL @@>, box true + <@@ Nullable<_> '3' ?<=? Nullable<_> '3' @@>, box true + <@@ Nullable<_> LanguagePrimitives.GenericOne ?<=? Nullable<_> LanguagePrimitives.GenericOne @@>, box true + <@@ Nullable<_> LanguagePrimitives.GenericOne ?<=? Nullable<_> LanguagePrimitives.GenericOne @@>, box true + <@@ Nullable<_> 3f ?<=? Nullable<_> 3f @@>, box true + <@@ Nullable<_> 3. ?<=? Nullable<_> 3. @@>, box true + <@@ Nullable<_> 3m ?<=? Nullable<_> 3m @@>, box true + <@@ Nullable<_> 3m ?<=? Nullable<_> 3m @@>, box true + <@@ Nullable<_> 3I ?<=? Nullable<_> 3I @@>, box true + + <@@ Nullable<_> 3y ?< 3y @@>, box false + <@@ Nullable<_> 3uy ?< 3uy @@>, box false + <@@ Nullable<_> 3s ?< 3s @@>, box false + <@@ Nullable<_> 3us ?< 3us @@>, box false + <@@ Nullable<_> 3 ?< 3 @@>, box false + <@@ Nullable<_> 3u ?< 3u @@>, box false + <@@ Nullable<_> 3L ?< 3L @@>, box false + <@@ Nullable<_> 3UL ?< 3UL @@>, box false + <@@ Nullable<_> '3' ?< '3' @@>, box false + <@@ Nullable<_> LanguagePrimitives.GenericOne ?< LanguagePrimitives.GenericOne @@>, box false + <@@ Nullable<_> LanguagePrimitives.GenericOne ?< LanguagePrimitives.GenericOne @@>, box false + <@@ Nullable<_> 3f ?< 3f @@>, box false + <@@ Nullable<_> 3. ?< 3. @@>, box false + <@@ Nullable<_> 3m ?< 3m @@>, box false + <@@ Nullable<_> 3m ?< 3m @@>, box false + <@@ Nullable<_> 3I ?< 3I @@>, box false + + <@@ 3y 3y @@>, box false + <@@ 3uy 3uy @@>, box false + <@@ 3s 3s @@>, box false + <@@ 3us 3us @@>, box false + <@@ 3 3 @@>, box false + <@@ 3u 3u @@>, box false + <@@ 3L 3L @@>, box false + <@@ 3UL 3UL @@>, box false + <@@ '3' '3' @@>, box false + <@@ LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box false + <@@ LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box false + <@@ 3f 3f @@>, box false + <@@ 3. 3. @@>, box false + <@@ 3m 3m @@>, box false + <@@ 3m 3m @@>, box false + <@@ 3I 3I @@>, box false + + <@@ Nullable<_> 3y ? 3y @@>, box false + <@@ Nullable<_> 3uy ? 3uy @@>, box false + <@@ Nullable<_> 3s ? 3s @@>, box false + <@@ Nullable<_> 3us ? 3us @@>, box false + <@@ Nullable<_> 3 ? 3 @@>, box false + <@@ Nullable<_> 3u ? 3u @@>, box false + <@@ Nullable<_> 3L ? 3L @@>, box false + <@@ Nullable<_> 3UL ? 3UL @@>, box false + <@@ Nullable<_> '3' ? '3' @@>, box false + <@@ Nullable<_> LanguagePrimitives.GenericOne ? LanguagePrimitives.GenericOne @@>, box false + <@@ Nullable<_> LanguagePrimitives.GenericOne ? LanguagePrimitives.GenericOne @@>, box false + <@@ Nullable<_> 3f ? 3f @@>, box false + <@@ Nullable<_> 3. ? 3. @@>, box false + <@@ Nullable<_> 3m ? 3m @@>, box false + <@@ Nullable<_> 3m ? 3m @@>, box false + <@@ Nullable<_> 3I ? 3I @@>, box false + + <@@ Nullable<_> 3y ?>= 3y @@>, box true + <@@ Nullable<_> 3uy ?>= 3uy @@>, box true + <@@ Nullable<_> 3s ?>= 3s @@>, box true + <@@ Nullable<_> 3us ?>= 3us @@>, box true + <@@ Nullable<_> 3 ?>= 3 @@>, box true + <@@ Nullable<_> 3u ?>= 3u @@>, box true + <@@ Nullable<_> 3L ?>= 3L @@>, box true + <@@ Nullable<_> 3UL ?>= 3UL @@>, box true + <@@ Nullable<_> '3' ?>= '3' @@>, box true + <@@ Nullable<_> LanguagePrimitives.GenericOne ?>= LanguagePrimitives.GenericOne @@>, box true + <@@ Nullable<_> LanguagePrimitives.GenericOne ?>= LanguagePrimitives.GenericOne @@>, box true + <@@ Nullable<_> 3f ?>= 3f @@>, box true + <@@ Nullable<_> 3. ?>= 3. @@>, box true + <@@ Nullable<_> 3m ?>= 3m @@>, box true + <@@ Nullable<_> 3m ?>= 3m @@>, box true + <@@ Nullable<_> 3I ?>= 3I @@>, box true + + <@@ 3y >=? Nullable<_> 3y @@>, box true + <@@ 3uy >=? Nullable<_> 3uy @@>, box true + <@@ 3s >=? Nullable<_> 3s @@>, box true + <@@ 3us >=? Nullable<_> 3us @@>, box true + <@@ 3 >=? Nullable<_> 3 @@>, box true + <@@ 3u >=? Nullable<_> 3u @@>, box true + <@@ 3L >=? Nullable<_> 3L @@>, box true + <@@ 3UL >=? Nullable<_> 3UL @@>, box true + <@@ '3' >=? Nullable<_> '3' @@>, box true + <@@ LanguagePrimitives.GenericOne >=? Nullable<_> LanguagePrimitives.GenericOne @@>, box true + <@@ LanguagePrimitives.GenericOne >=? Nullable<_> LanguagePrimitives.GenericOne @@>, box true + <@@ 3f >=? Nullable<_> 3f @@>, box true + <@@ 3. >=? Nullable<_> 3. @@>, box true + <@@ 3m >=? Nullable<_> 3m @@>, box true + <@@ 3m >=? Nullable<_> 3m @@>, box true + <@@ 3I >=? Nullable<_> 3I @@>, box true + + <@@ Nullable<_> 3y ?>=? Nullable<_> 3y @@>, box true + <@@ Nullable<_> 3uy ?>=? Nullable<_> 3uy @@>, box true + <@@ Nullable<_> 3s ?>=? Nullable<_> 3s @@>, box true + <@@ Nullable<_> 3us ?>=? Nullable<_> 3us @@>, box true + <@@ Nullable<_> 3 ?>=? Nullable<_> 3 @@>, box true + <@@ Nullable<_> 3u ?>=? Nullable<_> 3u @@>, box true + <@@ Nullable<_> 3L ?>=? Nullable<_> 3L @@>, box true + <@@ Nullable<_> 3UL ?>=? Nullable<_> 3UL @@>, box true + <@@ Nullable<_> '3' ?>=? Nullable<_> '3' @@>, box true + <@@ Nullable<_> LanguagePrimitives.GenericOne ?>=? Nullable<_> LanguagePrimitives.GenericOne @@>, box true + <@@ Nullable<_> LanguagePrimitives.GenericOne ?>=? Nullable<_> LanguagePrimitives.GenericOne @@>, box true + <@@ Nullable<_> 3f ?>=? Nullable<_> 3f @@>, box true + <@@ Nullable<_> 3. ?>=? Nullable<_> 3. @@>, box true + <@@ Nullable<_> 3m ?>=? Nullable<_> 3m @@>, box true + <@@ Nullable<_> 3m ?>=? Nullable<_> 3m @@>, box true + <@@ Nullable<_> 3I ?>=? Nullable<_> 3I @@>, box true + + <@@ Nullable<_> 3y ?> 3y @@>, box false + <@@ Nullable<_> 3uy ?> 3uy @@>, box false + <@@ Nullable<_> 3s ?> 3s @@>, box false + <@@ Nullable<_> 3us ?> 3us @@>, box false + <@@ Nullable<_> 3 ?> 3 @@>, box false + <@@ Nullable<_> 3u ?> 3u @@>, box false + <@@ Nullable<_> 3L ?> 3L @@>, box false + <@@ Nullable<_> 3UL ?> 3UL @@>, box false + <@@ Nullable<_> '3' ?> '3' @@>, box false + <@@ Nullable<_> LanguagePrimitives.GenericOne ?> LanguagePrimitives.GenericOne @@>, box false + <@@ Nullable<_> LanguagePrimitives.GenericOne ?> LanguagePrimitives.GenericOne @@>, box false + <@@ Nullable<_> 3f ?> 3f @@>, box false + <@@ Nullable<_> 3. ?> 3. @@>, box false + <@@ Nullable<_> 3m ?> 3m @@>, box false + <@@ Nullable<_> 3m ?> 3m @@>, box false + <@@ Nullable<_> 3I ?> 3I @@>, box false + + <@@ 3y >? Nullable<_> 3y @@>, box false + <@@ 3uy >? Nullable<_> 3uy @@>, box false + <@@ 3s >? Nullable<_> 3s @@>, box false + <@@ 3us >? Nullable<_> 3us @@>, box false + <@@ 3 >? Nullable<_> 3 @@>, box false + <@@ 3u >? Nullable<_> 3u @@>, box false + <@@ 3L >? Nullable<_> 3L @@>, box false + <@@ 3UL >? Nullable<_> 3UL @@>, box false + <@@ '3' >? Nullable<_> '3' @@>, box false + <@@ LanguagePrimitives.GenericOne >? Nullable<_> LanguagePrimitives.GenericOne @@>, box false + <@@ LanguagePrimitives.GenericOne >? Nullable<_> LanguagePrimitives.GenericOne @@>, box false + <@@ 3f >? Nullable<_> 3f @@>, box false + <@@ 3. >? Nullable<_> 3. @@>, box false + <@@ 3m >? Nullable<_> 3m @@>, box false + <@@ 3m >? Nullable<_> 3m @@>, box false + <@@ 3I >? Nullable<_> 3I @@>, box false + + <@@ Nullable<_> 3y ?>? Nullable<_> 3y @@>, box false + <@@ Nullable<_> 3uy ?>? Nullable<_> 3uy @@>, box false + <@@ Nullable<_> 3s ?>? Nullable<_> 3s @@>, box false + <@@ Nullable<_> 3us ?>? Nullable<_> 3us @@>, box false + <@@ Nullable<_> 3 ?>? Nullable<_> 3 @@>, box false + <@@ Nullable<_> 3u ?>? Nullable<_> 3u @@>, box false + <@@ Nullable<_> 3L ?>? Nullable<_> 3L @@>, box false + <@@ Nullable<_> 3UL ?>? Nullable<_> 3UL @@>, box false + <@@ Nullable<_> '3' ?>? Nullable<_> '3' @@>, box false + <@@ Nullable<_> LanguagePrimitives.GenericOne ?>? Nullable<_> LanguagePrimitives.GenericOne @@>, box false + <@@ Nullable<_> LanguagePrimitives.GenericOne ?>? Nullable<_> LanguagePrimitives.GenericOne @@>, box false + <@@ Nullable<_> 3f ?>? Nullable<_> 3f @@>, box false + <@@ Nullable<_> 3. ?>? Nullable<_> 3. @@>, box false + <@@ Nullable<_> 3m ?>? Nullable<_> 3m @@>, box false + <@@ Nullable<_> 3m ?>? Nullable<_> 3m @@>, box false + <@@ Nullable<_> 3I ?>? Nullable<_> 3I @@>, box false + |] + tests |> Array.map (fun (test, eval) -> + begin + printfn "--> Checking we can evaluate %A" test + let res = FSharp.Linq.RuntimeHelpers.LeafExpressionConverter.EvaluateQuotation test + let b = res = eval + if b then printfn "--- Success, it is %A which is equal to %A" res eval + else printfn "!!! FAILURE, it is %A which is not equal to %A" res eval + b + end + && + match test with + | CallWithWitnesses(None, minfo1, minfo2, witnessArgs, args) -> + printfn " + printfn "<-- Success, it did not match Quotations.Patterns.(|CallWithWitnesses|_|)" + true) |> Array.forall id) // Don't short circuit on a failed test module MoreWitnessTests = open System.Runtime.CompilerServices diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index d8c4bd79cc2..d4da2adaf94 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -1060,10 +1060,13 @@ module CoreTests = let rawFileErr = tryCreateTemporaryFileName () ``fsi b 2>c`` "%s --nologo --preferreduilang:en-US %s" fsc_flags_errors_ok flag ("test.fsx", rawFileOut, rawFileErr) - // REM REVIEW: want to normalise CWD paths, not suppress them. - let ``findstr /v`` text = Seq.filter (fun (s: string) -> not <| s.Contains(text)) - let removeCDandHelp from' to' = - File.ReadLines from' |> (``findstr /v`` cfg.Directory) |> (``findstr /v`` "--help' for options") |> (fun lines -> File.WriteAllLines(getfullpath cfg to', lines)) + let removeCDandHelp fromFile toFile = + File.ReadAllLines fromFile + |> Array.filter (fun s -> not (s.Contains(cfg.Directory))) + |> Array.filter (fun s -> not (s.Contains("--help' for options"))) + |> Array.filter (fun s -> not (s.Contains("[Loading"))) + |> Array.filter (fun s -> not (s.Contains("Binding session"))) + |> (fun lines -> File.WriteAllLines(getfullpath cfg toFile, lines)) removeCDandHelp rawFileOut diffFileOut removeCDandHelp rawFileErr diffFileErr diff --git a/tests/fsharp/tools/eval/test.fsx b/tests/fsharp/tools/eval/test.fsx index a289c17794a..f6a669653ce 100644 --- a/tests/fsharp/tools/eval/test.fsx +++ b/tests/fsharp/tools/eval/test.fsx @@ -1236,6 +1236,7 @@ module EvaluationTests = check "vroievr097q" (LanguagePrimitives.AdditionDynamic 3.0 4.0) 7.0 check "vroievr097w" (LanguagePrimitives.AdditionDynamic 3.0f 4.0f) 7.0f check "vroievr097e" (LanguagePrimitives.AdditionDynamic 3.0M 4.0M) 7.0M + check "vroievr097n" (LanguagePrimitives.AdditionDynamic '3' '\004') '7' check "vroievr097r" (LanguagePrimitives.CheckedAdditionDynamic 3y 4y) 7y check "vroievr097t" (LanguagePrimitives.CheckedAdditionDynamic 3s 4s) 7s @@ -1250,6 +1251,37 @@ module EvaluationTests = check "vroievr097f" (LanguagePrimitives.CheckedAdditionDynamic 3.0 4.0) 7.0 check "vroievr097g" (LanguagePrimitives.CheckedAdditionDynamic 3.0f 4.0f) 7.0f check "vroievr097h" (LanguagePrimitives.CheckedAdditionDynamic 3.0M 4.0M) 7.0M + check "vroievr097u" (LanguagePrimitives.CheckedAdditionDynamic '3' '\004') '7' + + check "vroievr0981" (LanguagePrimitives.SubtractionDynamic 7y 4y) 3y + check "vroievr0982" (LanguagePrimitives.SubtractionDynamic 7s 4s) 3s + check "vroievr0983" (LanguagePrimitives.SubtractionDynamic 7 4) 3 + check "vroievr0984" (LanguagePrimitives.SubtractionDynamic 7L 4L) 3L + check "vroievr0985" (LanguagePrimitives.SubtractionDynamic 7n 4n) 3n + check "vroievr0986" (LanguagePrimitives.SubtractionDynamic 7uy 4uy) 3uy + check "vroievr0987" (LanguagePrimitives.SubtractionDynamic 7us 4us) 3us + check "vroievr0988" (LanguagePrimitives.SubtractionDynamic 7u 4u) 3u + check "vroievr0989" (LanguagePrimitives.SubtractionDynamic 7UL 4UL) 3UL + check "vroievr0980" (LanguagePrimitives.SubtractionDynamic 7un 4un) 3un + check "vroievr098q" (LanguagePrimitives.SubtractionDynamic 7.0 4.0) 3.0 + check "vroievr098w" (LanguagePrimitives.SubtractionDynamic 7.0f 4.0f) 3.0f + check "vroievr098e" (LanguagePrimitives.SubtractionDynamic 7.0M 4.0M) 3.0M + check "vroievr098n" (LanguagePrimitives.SubtractionDynamic '7' '\004') '3' + + check "vroievr098r" (LanguagePrimitives.CheckedSubtractionDynamic 7y 4y) 3y + check "vroievr098t" (LanguagePrimitives.CheckedSubtractionDynamic 7s 4s) 3s + check "vroievr098y" (LanguagePrimitives.CheckedSubtractionDynamic 7 4) 3 + check "vroievr098u" (LanguagePrimitives.CheckedSubtractionDynamic 7L 4L) 3L + check "vroievr098i" (LanguagePrimitives.CheckedSubtractionDynamic 7n 4n) 3n + check "vroievr098o" (LanguagePrimitives.CheckedSubtractionDynamic 7uy 4uy) 3uy + check "vroievr098p" (LanguagePrimitives.CheckedSubtractionDynamic 7us 4us) 3us + check "vroievr098a" (LanguagePrimitives.CheckedSubtractionDynamic 7u 4u) 3u + check "vroievr098s" (LanguagePrimitives.CheckedSubtractionDynamic 7UL 4UL) 3UL + check "vroievr098d" (LanguagePrimitives.CheckedSubtractionDynamic 7un 4un) 3un + check "vroievr098f" (LanguagePrimitives.CheckedSubtractionDynamic 7.0 4.0) 3.0 + check "vroievr098g" (LanguagePrimitives.CheckedSubtractionDynamic 7.0f 4.0f) 3.0f + check "vroievr098h" (LanguagePrimitives.CheckedSubtractionDynamic 7.0M 4.0M) 3.0M + check "vroievr098u" (LanguagePrimitives.CheckedSubtractionDynamic '7' '\004') '3' check "vroievr0912q" (LanguagePrimitives.MultiplyDynamic 3y 4y) 12y check "vroievr0912w" (LanguagePrimitives.MultiplyDynamic 3s 4s) 12s @@ -1265,7 +1297,6 @@ module EvaluationTests = check "vroievr0912s" (LanguagePrimitives.MultiplyDynamic 3.0f 4.0f) 12.0f check "vroievr0912d" (LanguagePrimitives.MultiplyDynamic 3.0M 4.0M) 12.0M - check "vroievr0912f" (LanguagePrimitives.CheckedMultiplyDynamic 3y 4y) 12y check "vroievr0912g" (LanguagePrimitives.CheckedMultiplyDynamic 3s 4s) 12s check "vroievr0912h" (LanguagePrimitives.CheckedMultiplyDynamic 3 4) 12 diff --git a/tests/scripts/identifierAnalysisByType.fsx b/tests/scripts/identifierAnalysisByType.fsx index 7ac8de7a20b..d3b5c4e9415 100644 --- a/tests/scripts/identifierAnalysisByType.fsx +++ b/tests/scripts/identifierAnalysisByType.fsx @@ -60,7 +60,7 @@ symbols |> Array.filter (fun (v, _) -> v.GenericParameters.Count = 0) |> Array.filter (fun (v, _) -> v.CurriedParameterGroups.Count = 0) |> Array.filter (fun (v, _) -> not v.FullType.IsGenericParameter) -|> Array.map (fun (v, vUse) -> getTypeText v, v, vUse) +|> Array.map (fun (v, vUse) -> getTypeText v, v, vUse.ToString()) |> Array.filter (fun (vTypeText, v, _) -> match vTypeText with | "System.String" -> false @@ -77,6 +77,7 @@ symbols |> Array.map (fun (key, g) -> key, (g + |> Array.distinctBy (fun (_, _, vUse) -> vUse) |> Array.groupBy (fun (_, v, _) -> v.DisplayName) |> Array.sortByDescending (snd >> Array.length))) |> Array.filter (fun (_, g) -> g.Length > 1) @@ -87,7 +88,7 @@ symbols for (nm, entries) in g do printfn " %s (%d times)" nm (Array.length entries) for (_, _, vUse) in entries do - printfn " %s" (vUse.ToString()) + printfn " %s" vUse printfn "") (* diff --git a/tests/service/ExprTests.fs b/tests/service/ExprTests.fs index 05b42f7a67d..9a1f6d6bb56 100644 --- a/tests/service/ExprTests.fs +++ b/tests/service/ExprTests.fs @@ -1184,7 +1184,7 @@ let ``Test Operator Declarations for Byte`` () = [], "let testByteAdditionChecked(e1) (e2) = Checked.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),Checked.op_Addition (fun arg0_0 -> fun arg1_0 -> LanguagePrimitives.AdditionDynamic (arg0_0,arg1_0),e1,e2)) @ (24,53--24,70)" [], "let testByteSubtractionChecked(e1) (e2) = Checked.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),Checked.op_Subtraction (fun arg0_0 -> fun arg1_0 -> LanguagePrimitives.SubtractionDynamic (arg0_0,arg1_0),e1,e2)) @ (25,53--25,70)" [], "let testByteMultiplyChecked(e1) (e2) = Checked.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),Checked.op_Multiply (fun arg0_0 -> fun arg1_0 -> LanguagePrimitives.MultiplyDynamic (arg0_0,arg1_0),e1,e2)) @ (26,53--26,70)" - [], "let testByteToByteChecked(e1) = Checked.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (29,43--29,58)" + [], "let testByteToByteChecked(e1) = e1 @ (29,56--29,58)" [], "let testByteToSByteChecked(e1) = Checked.ToSByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (30,43--30,59)" [], "let testByteToInt16Checked(e1) = Checked.ToInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (31,43--31,59)" [], "let testByteToUInt16Checked(e1) = Checked.ToUInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (32,43--32,60)" @@ -1195,7 +1195,7 @@ let ``Test Operator Declarations for Byte`` () = [], "let testByteToUInt64Checked(e1) = Checked.ToUInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (37,43--37,60)" [], "let testByteToIntPtrChecked(e1) = Checked.ToIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (38,43--38,63)" [], "let testByteToUIntPtrChecked(e1) = Checked.ToUIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (39,43--39,64)" - [], "let testByteToByteOperator(e1) = Operators.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (41,43--41,50)" + [], "let testByteToByteOperator(e1) = e1 @ (41,48--41,50)" [], "let testByteToSByteOperator(e1) = Operators.ToSByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (42,43--42,51)" [], "let testByteToInt16Operator(e1) = Operators.ToInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (43,43--43,51)" [], "let testByteToUInt16Operator(e1) = Operators.ToUInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (44,43--44,52)" @@ -1296,7 +1296,7 @@ let ``Test Operator Declarations for SByte`` () = [], "let testSByteMultiplyChecked(e1) (e2) = Checked.ToSByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),Checked.op_Multiply (fun arg0_0 -> fun arg1_0 -> LanguagePrimitives.MultiplyDynamic (arg0_0,arg1_0),e1,e2)) @ (26,56--26,73)" [], "let testSByteUnaryNegChecked(e1) = Checked.op_Subtraction (fun arg0_0 -> fun arg1_0 -> LanguagePrimitives.SubtractionDynamic (arg0_0,arg1_0),0,e1) @ (27,45--27,60)" [], "let testSByteToByteChecked(e1) = Checked.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (29,45--29,60)" - [], "let testSByteToSByteChecked(e1) = Checked.ToSByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (30,45--30,61)" + [], "let testSByteToSByteChecked(e1) = e1 @ (30,59--30,61)" [], "let testSByteToInt16Checked(e1) = Checked.ToInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (31,45--31,61)" [], "let testSByteToUInt16Checked(e1) = Checked.ToUInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (32,45--32,62)" [], "let testSByteToIntChecked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (33,45--33,59)" @@ -1307,7 +1307,7 @@ let ``Test Operator Declarations for SByte`` () = [], "let testSByteToIntPtrChecked(e1) = Checked.ToIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (38,45--38,65)" [], "let testSByteToUIntPtrChecked(e1) = Checked.ToUIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (39,45--39,66)" [], "let testSByteToByteOperator(e1) = Operators.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (41,45--41,52)" - [], "let testSByteToSByteOperator(e1) = Operators.ToSByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (42,45--42,53)" + [], "let testSByteToSByteOperator(e1) = e1 @ (42,51--42,53)" [], "let testSByteToInt16Operator(e1) = Operators.ToInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (43,45--43,53)" [], "let testSByteToUInt16Operator(e1) = Operators.ToUInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (44,45--44,54)" [], "let testSByteToIntOperator(e1) = Operators.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (45,45--45,51)" @@ -1406,7 +1406,7 @@ let ``Test Operator Declarations for Int16`` () = [], "let testInt16UnaryNegChecked(e1) = Checked.op_Subtraction (fun arg0_0 -> fun arg1_0 -> LanguagePrimitives.SubtractionDynamic (arg0_0,arg1_0),0,e1) @ (27,45--27,60)" [], "let testInt16ToByteChecked(e1) = Checked.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (29,45--29,60)" [], "let testInt16ToSByteChecked(e1) = Checked.ToSByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (30,45--30,61)" - [], "let testInt16ToInt16Checked(e1) = Checked.ToInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (31,45--31,61)" + [], "let testInt16ToInt16Checked(e1) = e1 @ (31,59--31,61)" [], "let testInt16ToUInt16Checked(e1) = Checked.ToUInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (32,45--32,62)" [], "let testInt16ToIntChecked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (33,45--33,59)" [], "let testInt16ToInt32Checked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (34,45--34,61)" @@ -1417,7 +1417,7 @@ let ``Test Operator Declarations for Int16`` () = [], "let testInt16ToUIntPtrChecked(e1) = Checked.ToUIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (39,45--39,66)" [], "let testInt16ToByteOperator(e1) = Operators.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (41,45--41,52)" [], "let testInt16ToSByteOperator(e1) = Operators.ToSByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (42,45--42,53)" - [], "let testInt16ToInt16Operator(e1) = Operators.ToInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (43,45--43,53)" + [], "let testInt16ToInt16Operator(e1) = e1 @ (43,51--43,53)" [], "let testInt16ToUInt16Operator(e1) = Operators.ToUInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (44,45--44,54)" [], "let testInt16ToIntOperator(e1) = Operators.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (45,45--45,51)" [], "let testInt16ToInt32Operator(e1) = Operators.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (46,45--46,53)" @@ -1515,7 +1515,7 @@ let ``Test Operator Declarations for UInt16`` () = [], "let testUInt16ToByteChecked(e1) = Checked.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (29,47--29,62)" [], "let testUInt16ToSByteChecked(e1) = Checked.ToSByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (30,47--30,63)" [], "let testUInt16ToInt16Checked(e1) = Checked.ToInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (31,47--31,63)" - [], "let testUInt16ToUInt16Checked(e1) = Checked.ToUInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (32,47--32,64)" + [], "let testUInt16ToUInt16Checked(e1) = e1 @ (32,62--32,64)" [], "let testUInt16ToIntChecked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (33,47--33,61)" [], "let testUInt16ToInt32Checked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (34,47--34,63)" [], "let testUInt16ToUInt32Checked(e1) = Checked.ToUInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (35,47--35,64)" @@ -1526,7 +1526,7 @@ let ``Test Operator Declarations for UInt16`` () = [], "let testUInt16ToByteOperator(e1) = Operators.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (41,47--41,54)" [], "let testUInt16ToSByteOperator(e1) = Operators.ToSByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (42,47--42,55)" [], "let testUInt16ToInt16Operator(e1) = Operators.ToInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (43,47--43,55)" - [], "let testUInt16ToUInt16Operator(e1) = Operators.ToUInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (44,47--44,56)" + [], "let testUInt16ToUInt16Operator(e1) = e1 @ (44,54--44,56)" [], "let testUInt16ToIntOperator(e1) = Operators.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (45,47--45,53)" [], "let testUInt16ToInt32Operator(e1) = Operators.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (46,47--46,55)" [], "let testUInt16ToUInt32Operator(e1) = Operators.ToUInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (47,47--47,56)" @@ -1537,7 +1537,7 @@ let ``Test Operator Declarations for UInt16`` () = [], "let testUInt16ToSingleOperator(e1) = Operators.ToSingle (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),Operators.ToDouble (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1)) @ (52,47--52,57)" [], "let testUInt16ToDoubleOperator(e1) = Operators.ToDouble (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),Operators.ToDouble (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1)) @ (53,47--53,55)" [], "let testUInt16ToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,47--54,57)" - [], "let testUInt16ToCharOperator(e1) = Operators.ToChar (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (55,47--55,54)" + [], "let testUInt16ToCharOperator(e1) = e1 @ (55,47--55,54)" [FC47; FC50], "let testUInt16ToStringOperator(e1) = let mutable copyOfStruct: Microsoft.FSharp.Core.uint16 = e1 in copyOfStruct.ToString() @ (56,47--56,56)" ] @@ -1625,8 +1625,8 @@ let ``Test Operator Declarations for Int`` () = [], "let testIntToSByteChecked(e1) = Checked.ToSByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (30,41--30,57)" [], "let testIntToInt16Checked(e1) = Checked.ToInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (31,41--31,57)" [], "let testIntToUInt16Checked(e1) = Checked.ToUInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (32,41--32,58)" - [], "let testIntToIntChecked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (33,41--33,55)" - [], "let testIntToInt32Checked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (34,41--34,57)" + [], "let testIntToIntChecked(e1) = e1 @ (33,53--33,55)" + [], "let testIntToInt32Checked(e1) = e1 @ (34,55--34,57)" [], "let testIntToUInt32Checked(e1) = Checked.ToUInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (35,41--35,58)" [], "let testIntToInt64Checked(e1) = Checked.ToInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (36,41--36,57)" [], "let testIntToUInt64Checked(e1) = Checked.ToUInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (37,41--37,58)" @@ -1734,8 +1734,8 @@ let ``Test Operator Declarations for Int32`` () = [], "let testInt32ToSByteChecked(e1) = Checked.ToSByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (30,45--30,61)" [], "let testInt32ToInt16Checked(e1) = Checked.ToInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (31,45--31,61)" [], "let testInt32ToUInt16Checked(e1) = Checked.ToUInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (32,45--32,62)" - [], "let testInt32ToIntChecked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (33,45--33,59)" - [], "let testInt32ToInt32Checked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (34,45--34,61)" + [], "let testInt32ToIntChecked(e1) = e1 @ (33,57--33,59)" + [], "let testInt32ToInt32Checked(e1) = e1 @ (34,59--34,61)" [], "let testInt32ToUInt32Checked(e1) = Checked.ToUInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (35,45--35,62)" [], "let testInt32ToInt64Checked(e1) = Checked.ToInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (36,45--36,61)" [], "let testInt32ToUInt64Checked(e1) = Checked.ToUInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (37,45--37,62)" @@ -1845,7 +1845,7 @@ let ``Test Operator Declarations for UInt32`` () = [], "let testUInt32ToUInt16Checked(e1) = Checked.ToUInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (32,47--32,64)" [], "let testUInt32ToIntChecked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (33,47--33,61)" [], "let testUInt32ToInt32Checked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (34,47--34,63)" - [], "let testUInt32ToUInt32Checked(e1) = Checked.ToUInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (35,47--35,64)" + [], "let testUInt32ToUInt32Checked(e1) = e1 @ (35,62--35,64)" [], "let testUInt32ToInt64Checked(e1) = Checked.ToInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (36,47--36,63)" [], "let testUInt32ToUInt64Checked(e1) = Checked.ToUInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (37,47--37,64)" [], "let testUInt32ToIntPtrChecked(e1) = Checked.ToIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (38,47--38,67)" @@ -1856,7 +1856,7 @@ let ``Test Operator Declarations for UInt32`` () = [], "let testUInt32ToUInt16Operator(e1) = Operators.ToUInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (44,47--44,56)" [], "let testUInt32ToIntOperator(e1) = Operators.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (45,47--45,53)" [], "let testUInt32ToInt32Operator(e1) = Operators.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (46,47--46,55)" - [], "let testUInt32ToUInt32Operator(e1) = Operators.ToUInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (47,47--47,56)" + [], "let testUInt32ToUInt32Operator(e1) = e1 @ (47,54--47,56)" [], "let testUInt32ToInt64Operator(e1) = Operators.ToUInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (48,47--48,55)" [], "let testUInt32ToUInt64Operator(e1) = Operators.ToUInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (49,47--49,56)" [], "let testUInt32ToIntPtrOperator(e1) = Operators.ToUIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (50,47--50,59)" @@ -1955,7 +1955,7 @@ let ``Test Operator Declarations for Int64`` () = [], "let testInt64ToIntChecked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (33,45--33,59)" [], "let testInt64ToInt32Checked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (34,45--34,61)" [], "let testInt64ToUInt32Checked(e1) = Checked.ToUInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (35,45--35,62)" - [], "let testInt64ToInt64Checked(e1) = Checked.ToInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (36,45--36,61)" + [], "let testInt64ToInt64Checked(e1) = e1 @ (36,59--36,61)" [], "let testInt64ToUInt64Checked(e1) = Checked.ToUInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (37,45--37,62)" [], "let testInt64ToIntPtrChecked(e1) = Checked.ToIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (38,45--38,65)" [], "let testInt64ToUIntPtrChecked(e1) = Checked.ToUIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (39,45--39,66)" @@ -1966,7 +1966,7 @@ let ``Test Operator Declarations for Int64`` () = [], "let testInt64ToIntOperator(e1) = Operators.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (45,45--45,51)" [], "let testInt64ToInt32Operator(e1) = Operators.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (46,45--46,53)" [], "let testInt64ToUInt32Operator(e1) = Operators.ToUInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (47,45--47,54)" - [], "let testInt64ToInt64Operator(e1) = Operators.ToInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (48,45--48,53)" + [], "let testInt64ToInt64Operator(e1) = e1 @ (48,51--48,53)" [], "let testInt64ToUInt64Operator(e1) = Operators.ToUInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (49,45--49,54)" [], "let testInt64ToIntPtrOperator(e1) = Operators.ToIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (50,45--50,57)" [], "let testInt64ToUIntPtrOperator(e1) = Operators.ToIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (51,45--51,58)" @@ -2065,7 +2065,7 @@ let ``Test Operator Declarations for UInt64`` () = [], "let testUInt64ToInt32Checked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (34,47--34,63)" [], "let testUInt64ToUInt32Checked(e1) = Checked.ToUInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (35,47--35,64)" [], "let testUInt64ToInt64Checked(e1) = Checked.ToInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (36,47--36,63)" - [], "let testUInt64ToUInt64Checked(e1) = Checked.ToUInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (37,47--37,64)" + [], "let testUInt64ToUInt64Checked(e1) = e1 @ (37,62--37,64)" [], "let testUInt64ToIntPtrChecked(e1) = Checked.ToIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (38,47--38,67)" [], "let testUInt64ToUIntPtrChecked(e1) = Checked.ToUIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (39,47--39,68)" [], "let testUInt64ToByteOperator(e1) = Operators.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (41,47--41,54)" @@ -2175,7 +2175,7 @@ let ``Test Operator Declarations for IntPtr`` () = [], "let testIntPtrToUInt32Checked(e1) = Checked.ToUInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (35,50--35,67)" [], "let testIntPtrToInt64Checked(e1) = Checked.ToInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (36,50--36,66)" [], "let testIntPtrToUInt64Checked(e1) = Checked.ToUInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (37,50--37,67)" - [], "let testIntPtrToIntPtrChecked(e1) = Checked.ToIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (38,50--38,70)" + [], "let testIntPtrToIntPtrChecked(e1) = e1 @ (38,68--38,70)" [], "let testIntPtrToUIntPtrChecked(e1) = Checked.ToUIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (39,50--39,71)" [], "let testIntPtrToByteOperator(e1) = Operators.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (41,50--41,57)" [], "let testIntPtrToSByteOperator(e1) = Operators.ToSByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (42,50--42,58)" @@ -2186,7 +2186,7 @@ let ``Test Operator Declarations for IntPtr`` () = [], "let testIntPtrToUInt32Operator(e1) = Operators.ToUInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (47,50--47,59)" [], "let testIntPtrToInt64Operator(e1) = Operators.ToInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (48,50--48,58)" [], "let testIntPtrToUInt64Operator(e1) = Operators.ToInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (49,50--49,59)" - [], "let testIntPtrToIntPtrOperator(e1) = Operators.ToIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (50,50--50,62)" + [], "let testIntPtrToIntPtrOperator(e1) = e1 @ (50,60--50,62)" [], "let testIntPtrToUIntPtrOperator(e1) = Operators.ToUIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (51,50--51,63)" [], "let testIntPtrToSingleOperator(e1) = Operators.ToSingle (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (52,50--52,60)" [], "let testIntPtrToDoubleOperator(e1) = Operators.ToDouble (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (53,50--53,58)" @@ -2284,7 +2284,7 @@ let ``Test Operator Declarations for UIntPtr`` () = [], "let testUIntPtrToInt64Checked(e1) = Checked.ToInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (36,52--36,68)" [], "let testUIntPtrToUInt64Checked(e1) = Checked.ToUInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (37,52--37,69)" [], "let testUIntPtrToIntPtrChecked(e1) = Checked.ToIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (38,52--38,72)" - [], "let testUIntPtrToUIntPtrChecked(e1) = Checked.ToUIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (39,52--39,73)" + [], "let testUIntPtrToUIntPtrChecked(e1) = e1 @ (39,71--39,73)" [], "let testUIntPtrToByteOperator(e1) = Operators.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (41,52--41,59)" [], "let testUIntPtrToSByteOperator(e1) = Operators.ToSByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (42,52--42,60)" [], "let testUIntPtrToInt16Operator(e1) = Operators.ToInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (43,52--43,60)" @@ -2870,7 +2870,7 @@ let ``Test Operator Declarations for Char`` () = [], "let testCharToByteChecked(e1) = Checked.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (29,43--29,58)" [], "let testCharToSByteChecked(e1) = Checked.ToSByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (30,43--30,59)" [], "let testCharToInt16Checked(e1) = Checked.ToInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (31,43--31,59)" - [], "let testCharToUInt16Checked(e1) = Checked.ToUInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (32,43--32,60)" + [], "let testCharToUInt16Checked(e1) = Operators.ToUInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (32,43--32,60)" [], "let testCharToIntChecked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (33,43--33,57)" [], "let testCharToInt32Checked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (34,43--34,59)" [], "let testCharToUInt32Checked(e1) = Checked.ToUInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (35,43--35,60)" @@ -2891,7 +2891,7 @@ let ``Test Operator Declarations for Char`` () = [], "let testCharToUIntPtrOperator(e1) = Operators.ToUIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (51,43--51,56)" [], "let testCharToSingleOperator(e1) = Operators.ToSingle (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),Operators.ToDouble (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1)) @ (52,43--52,53)" [], "let testCharToDoubleOperator(e1) = Operators.ToDouble (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),Operators.ToDouble (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1)) @ (53,43--53,51)" - [], "let testCharToCharOperator(e1) = Operators.ToChar (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (55,43--55,50)" + [], "let testCharToCharOperator(e1) = e1 @ (55,48--55,50)" [FC47; FC50], "let testCharToStringOperator(e1) = let mutable copyOfStruct: Microsoft.FSharp.Core.char = e1 in copyOfStruct.ToString() @ (56,43--56,52)" ] From e4ef7b3d8b923e0d9b700dd48b2c22e8a7980a06 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Sat, 16 Jul 2022 09:17:21 -0700 Subject: [PATCH 06/51] versions (#13518) --- eng/Versions.props | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 6571c5fb21a..664020f8004 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 6 0 - 5 + 6 0 @@ -32,7 +32,7 @@ 41 0 - 5 + $(FSBuildVersion) $(FSRevisionVersion) $(FCSMajorVersion).$(FCSMinorVersion).$(FCSBuildVersion) $(FCSMajorVersion).$(FCSMinorVersion).$(FCSBuildVersion).$(FCSRevisionVersion) @@ -47,7 +47,7 @@ 12 0 - 4 + $(FSBuildVersion) $(FSRevisionVersion) $(FSToolsMajorVersion).$(FSToolsMinorVersion).$(FSToolsBuildVersion) $(FSToolsMajorVersion)-$(FSToolsMinorVersion)-$(FSToolsBuildVersion) @@ -55,7 +55,7 @@ 17 - 1 + 4 $(VSMajorVersion).0 $(VSMajorVersion).$(VSMinorVersion).0 $(VSAssemblyVersionPrefix).0 From d6f3c8971c3e43579ba977e2e639769fd8f2077b Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Mon, 25 Jul 2022 08:12:36 -0700 Subject: [PATCH 07/51] Merge main to release/dev17.4 (#13559) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Tomáš Matoušek --- eng/Versions.props | 131 ++++++++------- .../LanguageService/LanguageService.fs | 4 +- .../LegacyProjectWorkspaceMap.fs | 16 +- .../LanguageService/MetadataAsSource.fs | 16 +- .../LanguageService/SingleFileWorkspaceMap.fs | 150 +++--------------- .../FSharp.ProjectSystem.PropertyPages.vbproj | 1 + .../PropertyPages/ApplicationPropPageBase.vb | 17 +- .../PropertyPages/DebugPropPage.vb | 4 +- .../UnitTests/Workspace/WorkspaceTests.fs | 10 +- 9 files changed, 130 insertions(+), 219 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 84342d785c7..6d7059405f7 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -112,82 +112,91 @@ 4.3.0 6.0.0 4.5.0 - - 17.2.178-preview - 17.2.0-preview-1-32131-009 + + + 4.4.0-1.22368.2 + 17.3.133-preview + 17.3.0-preview-1-32407-044 17.0.77-pre-g62a6cb5699 - $(VisualStudioContractPackagesVersion) - $(VisualStudioContractPackagesVersion) - $(VisualStudioContractPackagesVersion) - 17.0.0-preview-1-31115-307 - $(VisualStudioContractPackagesVersion) - $(VisualStudioContractPackagesVersion) - $(VisualStudioContractPackagesVersion) - $(VisualStudioContractPackagesVersion) - $(VisualStudioContractPackagesVersion) - $(VisualStudioContractPackagesVersion) - $(VisualStudioContractPackagesVersion) - $(VisualStudioContractPackagesVersion) - $(VisualStudioContractPackagesVersion) - $(VisualStudioContractPackagesVersion) - $(VisualStudioContractPackagesVersion) - $(VisualStudioContractPackagesVersion) - $(VisualStudioContractPackagesVersion) - $(VisualStudioContractPackagesVersion) + 17.3.1-alpha + 17.1.0 + - 4.2.0-3.22154.1 $(RoslynVersion) $(RoslynVersion) $(RoslynVersion) $(RoslynVersion) $(RoslynVersion) $(RoslynVersion) - 2.0.28 $(RoslynVersion) + 2.0.28 + + + $(MicrosoftVisualStudioShellPackagesVersion) + $(MicrosoftVisualStudioShellPackagesVersion) + $(MicrosoftVisualStudioShellPackagesVersion) + $(MicrosoftVisualStudioShellPackagesVersion) + $(MicrosoftVisualStudioShellPackagesVersion) + $(MicrosoftVisualStudioShellPackagesVersion) + $(MicrosoftVisualStudioShellPackagesVersion) + $(MicrosoftVisualStudioShellPackagesVersion) + $(MicrosoftVisualStudioShellPackagesVersion) + $(MicrosoftVisualStudioShellPackagesVersion) + $(MicrosoftVisualStudioShellPackagesVersion) + $(MicrosoftVisualStudioShellPackagesVersion) + $(MicrosoftVisualStudioShellPackagesVersion) + $(MicrosoftVisualStudioShellPackagesVersion) + $(MicrosoftVisualStudioShellPackagesVersion) + $(MicrosoftVisualStudioShellPackagesVersion) + $(MicrosoftVisualStudioShellPackagesVersion) + $(MicrosoftVisualStudioShellPackagesVersion) + $(MicrosoftVisualStudioShellPackagesVersion) + $(MicrosoftVisualStudioShellPackagesVersion) + $(MicrosoftVisualStudioShellPackagesVersion) + $(MicrosoftVisualStudioShellPackagesVersion) + $(MicrosoftVisualStudioShellPackagesVersion) + $(MicrosoftVisualStudioShellPackagesVersion) + $(MicrosoftVisualStudioShellPackagesVersion) + $(MicrosoftVisualStudioShellPackagesVersion) + $(MicrosoftVisualStudioShellPackagesVersion) + 14.3.25407 + 10.0.30319 + 11.0.50727 + 15.0.25123-Dev15Preview + 16.0.1 + 16.0.28924.11111 + - 17.0.0 $(MicrosoftBuildOverallPackagesVersion) $(MicrosoftBuildOverallPackagesVersion) $(MicrosoftBuildOverallPackagesVersion) $(MicrosoftBuildOverallPackagesVersion) - 17.1.4054 - - $(VisualStudioImplementationPackagesVersion) - $(VisualStudioImplementationPackagesVersion) - $(VisualStudioImplementationPackagesVersion) - $(VisualStudioImplementationPackagesVersion) - $(VisualStudioImplementationPackagesVersion) - $(VisualStudioImplementationPackagesVersion) - $(VisualStudioImplementationPackagesVersion) - $(VisualStudioImplementationPackagesVersion) - $(VisualStudioImplementationPackagesVersion) - $(VisualStudioImplementationPackagesVersion) - - 16.7.30329.88 - $(VisualStudioContractPackagesVersion) - $(VisualStudioContractPackagesVersion) - $(VisualStudioContractPackagesVersion) - $(VisualStudioContractPackagesVersion) - - 17.2.22-alpha - $(VisualStudioImplementationPackagesVersion) - 17.0.0 - $(VisualStudioContractPackagesVersion) - $(VisualStudioContractPackagesVersion) - $(VisualStudioContractPackagesVersion) - $(VisualStudioContractPackagesVersion) - $(VisualStudioContractPackagesVersion) + + + $(VisualStudioEditorPackagesVersion) + $(VisualStudioEditorPackagesVersion) + $(VisualStudioEditorPackagesVersion) + $(VisualStudioEditorPackagesVersion) + $(VisualStudioEditorPackagesVersion) + $(VisualStudioEditorPackagesVersion) + $(VisualStudioEditorPackagesVersion) + $(VisualStudioEditorPackagesVersion) + $(VisualStudioEditorPackagesVersion) + $(VisualStudioEditorPackagesVersion) + $(VisualStudioEditorPackagesVersion) + + + $(MicrosoftVisualStudioThreadingPackagesVersion) + + $(VisualStudioProjectSystemPackagesVersion) 2.3.6152103 - 14.3.25407 - 10.0.30319 - 11.0.50727 - 15.0.25123-Dev15Preview - 16.0.1 - 16.0.28924.11111 - 17.2.10-alpha - $(VisualStudioContractPackagesVersion) - 17.0.46 + + + 17.1.4054 + 17.3.3-alpha + 17.0.0 + 17.0.53 9.0.30729 6.0.0 12.0.4 @@ -216,7 +225,7 @@ 3.11.0 2.1.80 1.0.0-beta2-dev3 - 2.11.34 + 2.12.7-alpha 2.8.57 2.4.1 2.4.2 diff --git a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs index b50277c019b..203867a6afe 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs @@ -259,14 +259,14 @@ type internal FSharpPackage() as this = solutionEventsOpt <- Some(solutionEvents) solution.AdviseSolutionEvents(solutionEvents) |> ignore - let projectContextFactory = this.ComponentModel.GetService() + let projectContextFactory = this.ComponentModel.GetService() let miscFilesWorkspace = this.ComponentModel.GetService() let _singleFileWorkspaceMap = new SingleFileWorkspaceMap( FSharpMiscellaneousFileService( workspace, miscFilesWorkspace, - FSharpWorkspaceProjectContextFactory(projectContextFactory) + projectContextFactory ), rdt) let _legacyProjectWorkspaceMap = new LegacyProjectWorkspaceMap(solution, optionsManager, projectContextFactory) diff --git a/vsintegration/src/FSharp.Editor/LanguageService/LegacyProjectWorkspaceMap.fs b/vsintegration/src/FSharp.Editor/LanguageService/LegacyProjectWorkspaceMap.fs index 996ce1cadf8..78c6ad15785 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/LegacyProjectWorkspaceMap.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/LegacyProjectWorkspaceMap.fs @@ -12,6 +12,7 @@ open System.IO open System.Linq open System.Runtime.CompilerServices open Microsoft.CodeAnalysis +open Microsoft.CodeAnalysis.ExternalAccess.FSharp open Microsoft.VisualStudio open Microsoft.VisualStudio.FSharp.Editor open Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem @@ -21,10 +22,10 @@ open Microsoft.VisualStudio.Shell.Interop [] type internal LegacyProjectWorkspaceMap(solution: IVsSolution, projectInfoManager: FSharpProjectOptionsManager, - projectContextFactory: IWorkspaceProjectContextFactory) as this = + projectContextFactory: FSharpWorkspaceProjectContextFactory) as this = let invalidPathChars = set (Path.GetInvalidPathChars()) - let optionsAssociation = ConditionalWeakTable() + let optionsAssociation = ConditionalWeakTable() let isPathWellFormed (path: string) = not (String.IsNullOrWhiteSpace path) && path |> Seq.forall (fun c -> not (Set.contains c invalidPathChars)) let projectDisplayNameOf projectFileName = @@ -40,7 +41,7 @@ type internal LegacyProjectWorkspaceMap(solution: IVsSolution, /// Sync the Roslyn information for the project held in 'projectContext' to match the information given by 'site'. /// Also sync the info in ProjectInfoManager if necessary. - member this.SyncLegacyProject(projectContext: IWorkspaceProjectContext, site: IProjectSite) = + member this.SyncLegacyProject(projectContext: FSharpWorkspaceProjectContext, site: IProjectSite) = let wellFormedFilePathSetIgnoreCase (paths: seq) = HashSet(paths |> Seq.filter isPathWellFormed |> Seq.map (fun s -> try Path.GetFullPath(s) with _ -> s), StringComparer.OrdinalIgnoreCase) @@ -58,7 +59,7 @@ type internal LegacyProjectWorkspaceMap(solution: IVsSolution, for file in updatedFiles do if not(originalFiles.Contains(file)) then - projectContext.AddSourceFile(file) + projectContext.AddSourceFile(file, SourceCodeKind.Regular) for file in originalFiles do if not(updatedFiles.Contains(file)) then @@ -72,7 +73,7 @@ type internal LegacyProjectWorkspaceMap(solution: IVsSolution, for ref in updatedRefs do if not(originalRefs.Contains(ref)) then - projectContext.AddMetadataReference(ref, MetadataReferenceProperties.Assembly) + projectContext.AddMetadataReference(ref) for ref in originalRefs do if not(updatedRefs.Contains(ref)) then @@ -90,7 +91,7 @@ type internal LegacyProjectWorkspaceMap(solution: IVsSolution, //projectContext.SetOptions(String.concat " " updatedOptions) for file in updatedFiles do projectContext.RemoveSourceFile(file) - projectContext.AddSourceFile(file) + projectContext.AddSourceFile(file, SourceCodeKind.Regular) // Record the last seen options as an associated value if ok then optionsAssociation.Remove(projectContext) |> ignore @@ -119,7 +120,6 @@ type internal LegacyProjectWorkspaceMap(solution: IVsSolution, let projectContext = projectContextFactory.CreateProjectContext( - FSharpConstants.FSharpLanguageName, projectDisplayName, projectFileName, projectGuid, @@ -131,7 +131,7 @@ type internal LegacyProjectWorkspaceMap(solution: IVsSolution, // Sync IProjectSite --> projectContext, and IProjectSite --> ProjectInfoManage this.SyncLegacyProject(projectContext, site) - site.BuildErrorReporter <- Some (projectContext :?> Microsoft.VisualStudio.Shell.Interop.IVsLanguageServiceBuildErrorReporter2) + site.BuildErrorReporter <- Some (projectContext.BuildErrorReporter) // TODO: consider forceUpdate = false here. forceUpdate=true may be causing repeated computation? site.AdviseProjectSiteChanges(FSharpConstants.FSharpLanguageServiceCallbackName, diff --git a/vsintegration/src/FSharp.Editor/LanguageService/MetadataAsSource.fs b/vsintegration/src/FSharp.Editor/LanguageService/MetadataAsSource.fs index 3c205e68c87..0fe209093d0 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/MetadataAsSource.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/MetadataAsSource.fs @@ -17,6 +17,7 @@ open Microsoft.CodeAnalysis open Microsoft.CodeAnalysis.FindSymbols open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.Navigation +open Microsoft.CodeAnalysis.ExternalAccess.FSharp open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Navigation open Microsoft.VisualStudio.ComponentModelHost open Microsoft.VisualStudio.LanguageServices.ProjectSystem @@ -96,25 +97,26 @@ module internal MetadataAsSource = type internal FSharpMetadataAsSourceService() = let serviceProvider = ServiceProvider.GlobalProvider - let projs = System.Collections.Concurrent.ConcurrentDictionary() + let projs = System.Collections.Concurrent.ConcurrentDictionary() let createMetadataProjectContext (projInfo: ProjectInfo) (docInfo: DocumentInfo) = let componentModel = Package.GetGlobalService(typeof) :?> ComponentModelHost.IComponentModel - let projectContextFactory = componentModel.GetService() - let projectContext = projectContextFactory.CreateProjectContext(LanguageNames.FSharp, projInfo.Id.ToString(), projInfo.FilePath, Guid.NewGuid(), null, null) + let projectContextFactory = componentModel.GetService() + + let projectContext = projectContextFactory.CreateProjectContext(projInfo.FilePath, projInfo.Id.ToString()) projectContext.DisplayName <- projInfo.Name - projectContext.AddSourceFile(docInfo.FilePath, sourceCodeKind = SourceCodeKind.Regular) - + projectContext.AddSourceFile(docInfo.FilePath, SourceCodeKind.Regular) + for metaRef in projInfo.MetadataReferences do match metaRef with | :? PortableExecutableReference as peRef -> - projectContext.AddMetadataReference(peRef.FilePath, MetadataReferenceProperties.Assembly) + projectContext.AddMetadataReference(peRef.FilePath) | _ -> () projectContext - let clear filePath (projectContext: IWorkspaceProjectContext) = + let clear filePath (projectContext: IFSharpWorkspaceProjectContext) = projs.TryRemove(filePath) |> ignore projectContext.Dispose() try diff --git a/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs b/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs index 87aeb8264ee..7f596d17a82 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs @@ -4,125 +4,19 @@ namespace Microsoft.VisualStudio.FSharp.Editor open System open System.Collections.Concurrent -open System.Collections.Immutable open Microsoft.CodeAnalysis +open Microsoft.CodeAnalysis.ExternalAccess.FSharp open Microsoft.VisualStudio open Microsoft.VisualStudio.FSharp.Editor -open Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem -open Microsoft.VisualStudio.LanguageServices.ProjectSystem open Microsoft.VisualStudio.Shell.Interop -open Microsoft.VisualStudio.LanguageServices open FSharp.Compiler.CodeAnalysis -type internal IFSharpWorkspaceProjectContext = - inherit IDisposable - - abstract Id : ProjectId - - abstract FilePath : string - - abstract ProjectReferenceCount : int - - abstract HasProjectReference : filePath: string -> bool - - abstract SetProjectReferences : IFSharpWorkspaceProjectContext seq -> unit - - abstract MetadataReferenceCount : int - - abstract HasMetadataReference : referencePath: string -> bool - - abstract SetMetadataReferences : referencePaths: string seq -> unit - -type internal IFSharpWorkspaceProjectContextFactory = - - abstract CreateProjectContext : filePath: string -> IFSharpWorkspaceProjectContext - -type private ProjectContextState = - { - refs: ImmutableDictionary - metadataRefs: ImmutableHashSet - } - -type internal FSharpWorkspaceProjectContext(vsProjectContext: IWorkspaceProjectContext) = - - let mutable state = - { - refs = ImmutableDictionary.Create(StringComparer.OrdinalIgnoreCase) - metadataRefs = ImmutableHashSet.Create(equalityComparer = StringComparer.OrdinalIgnoreCase) - } - - member private _.VisualStudioProjectContext = vsProjectContext - - member private _.AddProjectReference(builder: ImmutableDictionary<_, _>.Builder, projectContext: IFSharpWorkspaceProjectContext) = - match projectContext with - | :? FSharpWorkspaceProjectContext as fsProjectContext -> - vsProjectContext.AddProjectReference(fsProjectContext.VisualStudioProjectContext, MetadataReferenceProperties.Assembly) - builder.Add(projectContext.FilePath, projectContext) - | _ -> - () - - member private _.RemoveProjectReference(projectContext: IFSharpWorkspaceProjectContext) = - match projectContext with - | :? FSharpWorkspaceProjectContext as fsProjectContext -> - vsProjectContext.RemoveProjectReference(fsProjectContext.VisualStudioProjectContext) - | _ -> - () - - member private _.AddMetadataReference(builder: ImmutableHashSet<_>.Builder, referencePath: string) = - vsProjectContext.AddMetadataReference(referencePath, MetadataReferenceProperties.Assembly) - builder.Add(referencePath) |> ignore - - member private _.RemoveMetadataReference(referencePath: string) = - vsProjectContext.RemoveMetadataReference(referencePath) - - interface IFSharpWorkspaceProjectContext with - - member _.Id = vsProjectContext.Id - - member _.FilePath = vsProjectContext.ProjectFilePath - - member _.ProjectReferenceCount = state.refs.Count - - member _.HasProjectReference(filePath) = state.refs.ContainsKey(filePath) - - member this.SetProjectReferences(projRefs) = - let builder = ImmutableDictionary.CreateBuilder() - - state.refs.Values - |> Seq.iter (fun x -> - this.RemoveProjectReference(x) - ) - - projRefs - |> Seq.iter (fun x -> - this.AddProjectReference(builder, x) - ) - - state <- { state with refs = builder.ToImmutable() } - - member _.MetadataReferenceCount = state.metadataRefs.Count - - member _.HasMetadataReference(referencePath) = state.metadataRefs.Contains(referencePath) - - member this.SetMetadataReferences(referencePaths) = - let builder = ImmutableHashSet.CreateBuilder() - - state.metadataRefs - |> Seq.iter (fun x -> - this.RemoveMetadataReference(x) - ) - - referencePaths - |> Seq.iter (fun x -> - this.AddMetadataReference(builder, x) - ) - - state <- { state with metadataRefs = builder.ToImmutable() } - - member _.Dispose() = - vsProjectContext.Dispose() +type internal FSharpMiscellaneousFileService(workspace: Workspace, + miscFilesWorkspace: Workspace, + projectContextFactory: IFSharpWorkspaceProjectContextFactory) = -type internal FSharpWorkspaceProjectContextFactory(projectContextFactory: IWorkspaceProjectContextFactory) = + let files = ConcurrentDictionary>(StringComparer.OrdinalIgnoreCase) + let optionsManager = workspace.Services.GetRequiredService().FSharpProjectOptionsManager static let createSourceCodeKind (filePath: string) = if isScriptFile filePath then @@ -130,21 +24,6 @@ type internal FSharpWorkspaceProjectContextFactory(projectContextFactory: IWorks else SourceCodeKind.Regular - interface IFSharpWorkspaceProjectContextFactory with - - member _.CreateProjectContext filePath = - let projectContext = projectContextFactory.CreateProjectContext(FSharpConstants.FSharpLanguageName, filePath, filePath, Guid.NewGuid(), null, null) - projectContext.DisplayName <- FSharpConstants.FSharpMiscellaneousFilesName - projectContext.AddSourceFile(filePath, sourceCodeKind = createSourceCodeKind filePath) - new FSharpWorkspaceProjectContext(projectContext) :> IFSharpWorkspaceProjectContext - -type internal FSharpMiscellaneousFileService(workspace: Workspace, - miscFilesWorkspace: Workspace, - projectContextFactory: IFSharpWorkspaceProjectContextFactory) = - - let files = ConcurrentDictionary>(StringComparer.OrdinalIgnoreCase) - let optionsManager = workspace.Services.GetRequiredService().FSharpProjectOptionsManager - static let mustUpdateProjectReferences (refSourceFiles: string []) (projectContext: IFSharpWorkspaceProjectContext) = refSourceFiles.Length <> projectContext.ProjectReferenceCount || ( @@ -161,6 +40,12 @@ type internal FSharpMiscellaneousFileService(workspace: Workspace, |> not ) + let createProjectContextForDocument (filePath: string) = + let context = projectContextFactory.CreateProjectContext(filePath, filePath) + context.DisplayName <- FSharpConstants.FSharpMiscellaneousFilesName + context.AddSourceFile(filePath, createSourceCodeKind filePath) + context + let tryRemove (document: Document) = let projIds = document.Project.Solution.GetDependentProjectIds(document.Project.Id) if projIds.Count = 0 then @@ -195,7 +80,8 @@ type internal FSharpMiscellaneousFileService(workspace: Workspace, let newProjRefs = refSourceFiles |> Array.map (fun filePath -> - let createProjectContext = lazy projectContextFactory.CreateProjectContext(filePath) + let createProjectContext = lazy createProjectContextForDocument(filePath) + if files.TryAdd(filePath, createProjectContext) then createProjectContext.Value else @@ -225,7 +111,9 @@ type internal FSharpMiscellaneousFileService(workspace: Workspace, // a F# miscellaneous project, which could be a script or not. if document.Project.IsFSharp && workspace.CurrentSolution.GetDocumentIdsWithFilePath(document.FilePath).Length = 0 then let filePath = document.FilePath - let createProjectContext = lazy projectContextFactory.CreateProjectContext(filePath) + + let createProjectContext = lazy createProjectContextForDocument(filePath) + if files.TryAdd(filePath, createProjectContext) then createProjectContext.Force() |> ignore ) @@ -293,7 +181,9 @@ type internal FSharpMiscellaneousFileService(workspace: Workspace, | Some(document) -> optionsManager.ClearSingleFileOptionsCache(document.Id) projectContext.Value.Dispose() - let newProjectContext = lazy projectContextFactory.CreateProjectContext(newFilePath) + + let newProjectContext = lazy createProjectContextForDocument(newFilePath) + if files.TryAdd(newFilePath, newProjectContext) then newProjectContext.Force() |> ignore else diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/FSharp.ProjectSystem.PropertyPages.vbproj b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/FSharp.ProjectSystem.PropertyPages.vbproj index a6b16f955b3..5f5f1a3b687 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/FSharp.ProjectSystem.PropertyPages.vbproj +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/FSharp.ProjectSystem.PropertyPages.vbproj @@ -24,6 +24,7 @@ true 2.0 {FCFB214C-462E-42B3-91CA-FC557EFEE74F} + true diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/PropertyPages/ApplicationPropPageBase.vb b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/PropertyPages/ApplicationPropPageBase.vb index 981ae080b12..f8633f96b78 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/PropertyPages/ApplicationPropPageBase.vb +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/PropertyPages/ApplicationPropPageBase.vb @@ -4,6 +4,7 @@ Imports EnvDTE Imports Microsoft.VisualBasic Imports System +Imports System.IO Imports System.Collections Imports System.ComponentModel Imports System.Diagnostics @@ -187,8 +188,8 @@ Namespace Microsoft.VisualStudio.Editors.PropertyPages sFileName = "" sInitialDirectory = "" Else - sFileName = System.IO.Path.GetFileName(sInitialDirectory) - sInitialDirectory = System.IO.Path.GetDirectoryName(sInitialDirectory) + sFileName = Path.GetFileName(sInitialDirectory) + sInitialDirectory = Path.GetDirectoryName(sInitialDirectory) End If Dim fileNames As ArrayList = Common.Utils.GetFilesViaBrowse(ServiceProvider, Me.Handle, sInitialDirectory, SR.GetString(SR.PPG_AddExistingFilesTitle), _ @@ -312,13 +313,13 @@ Namespace Microsoft.VisualStudio.Editors.PropertyPages End If ' Verify all the characters in the path are valid - If path.IndexOfAny(IO.Path.GetInvalidPathChars()) >= 0 Then + If path.IndexOfAny(System.IO.Path.GetInvalidPathChars()) >= 0 Then ShowErrorMessage(SR.GetString(SR.PPG_Application_CantAddIcon)) Return False End If - If Not IO.Path.IsPathRooted(path) Then - path = IO.Path.Combine(GetProjectPath(), path) + If Not System.IO.Path.IsPathRooted(path) Then + path = System.IO.Path.Combine(GetProjectPath(), path) End If If System.IO.File.Exists(path) Then @@ -328,7 +329,7 @@ Namespace Microsoft.VisualStudio.Editors.PropertyPages ' create the Image. Try Dim IconContents As Byte() = IO.File.ReadAllBytes(path) - Dim IconStream As New IO.MemoryStream(IconContents, 0, IconContents.Length) + Dim IconStream As New MemoryStream(IconContents, 0, IconContents.Length) ApplicationIconPictureBox.Image = IconToImage(New Icon(IconStream), ApplicationIconPictureBox.ClientSize) Catch ex As Exception Common.RethrowIfUnrecoverable(ex, True) @@ -413,7 +414,7 @@ Namespace Microsoft.VisualStudio.Editors.PropertyPages Protected Sub AddIconsFromProjectItem(ByVal ProjectItem As EnvDTE.ProjectItem, ByVal ApplicationIconCombobox As ComboBox) For Index As Short = 1 To ProjectItem.FileCount Dim FileName As String = ProjectItem.FileNames(Index) - Dim ext As String = System.IO.Path.GetExtension(FileName) + Dim ext As String = Path.GetExtension(FileName) If ext.Equals(".ico", StringComparison.OrdinalIgnoreCase) Then ApplicationIconCombobox.Items.Add(GetProjectRelativeFilePath(FileName)) End If @@ -527,7 +528,7 @@ Namespace Microsoft.VisualStudio.Editors.PropertyPages Protected Sub AddManifestsFromProjectItem(ByVal ProjectItem As EnvDTE.ProjectItem, ByVal ApplicationManifestCombobox As ComboBox) For Index As Short = 1 To ProjectItem.FileCount Dim FileName As String = ProjectItem.FileNames(Index) - Dim ext As String = System.IO.Path.GetExtension(FileName) + Dim ext As String = Path.GetExtension(FileName) If ext.Equals(".manifest", StringComparison.OrdinalIgnoreCase) Then ApplicationManifestCombobox.Items.Add(GetProjectRelativeFilePath(FileName)) End If diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/PropertyPages/DebugPropPage.vb b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/PropertyPages/DebugPropPage.vb index 5708fc56b74..00bd63a37d2 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/PropertyPages/DebugPropPage.vb +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/PropertyPages/DebugPropPage.vb @@ -22,7 +22,7 @@ Namespace Microsoft.VisualStudio.Editors.PropertyPages Private m_controlGroup As Control()() 'PERF: A note about the labels used as lines. The 3D label is being set to 1 px high, - ' so youre really only using the grey part of it. Using BorderStyle.Fixed3D seems + ' so you’re really only using the grey part of it. Using BorderStyle.Fixed3D seems ' to fire an extra resize OnHandleCreated. The simple solution is to use BorderStyle.None ' and BackColor = SystemColors.ControlDark. @@ -507,7 +507,7 @@ Namespace Microsoft.VisualStudio.Editors.PropertyPages If sInitialDirectory = "" Then Try sInitialDirectory = Path.Combine(GetDebugPathProjectPath(), GetSelectedConfigOutputPath()) - Catch ex As IO.IOException + Catch ex As IOException 'Ignore Catch ex As Exception Common.RethrowIfUnrecoverable(ex) diff --git a/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs b/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs index bcdcd67b66b..d13723b9697 100644 --- a/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs +++ b/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs @@ -11,6 +11,7 @@ open System.Collections.Immutable open System.Threading open Microsoft.VisualStudio.Composition open Microsoft.CodeAnalysis +open Microsoft.CodeAnalysis.ExternalAccess.FSharp open Microsoft.CodeAnalysis.Host open Microsoft.CodeAnalysis.Text open Microsoft.VisualStudio.FSharp.Editor @@ -184,6 +185,10 @@ module WorkspaceTests = interface IFSharpWorkspaceProjectContext with + member _.get_DisplayName() : string = "" + + member _.set_DisplayName(value: string) : unit = () + member _.Dispose(): unit = () member _.FilePath: string = mainProj.FilePath @@ -260,10 +265,13 @@ module WorkspaceTests = mainProj <- solution.GetProject(currentProj.Id) + member _.AddMetadataReference(_: string): unit = () + member _.AddSourceFile(_: string, _: SourceCodeKind): unit = () + type TestFSharpWorkspaceProjectContextFactory(workspace: Workspace, miscFilesWorkspace: Workspace) = interface IFSharpWorkspaceProjectContextFactory with - member _.CreateProjectContext(filePath: string): IFSharpWorkspaceProjectContext = + member _.CreateProjectContext(filePath: string, uniqueName: string): IFSharpWorkspaceProjectContext = match miscFilesWorkspace.CurrentSolution.GetDocumentIdsWithFilePath(filePath) |> Seq.tryExactlyOne with | Some docId -> let doc = miscFilesWorkspace.CurrentSolution.GetDocument(docId) From a8360b1ea50da44d1d88f46fe46d1bd10685260a Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Mon, 25 Jul 2022 20:00:40 +0200 Subject: [PATCH 08/51] Fix VSGeneralVersion (#13561) --- eng/Versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index 6d7059405f7..f894f4e1a93 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -56,7 +56,7 @@ 17 4 - $(VSMajorVersion).5 + $(VSMajorVersion).0 $(VSMajorVersion).$(VSMinorVersion).0 $(VSAssemblyVersionPrefix).0 From fb7b6c42462cd6fa550badb2d895e4ce4e15b47a Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Sun, 31 Jul 2022 10:09:50 -0700 Subject: [PATCH 09/51] Improve tfm /rid aquisition (#13582) (#13604) * Improve tfm aquisition * revert desktop to net472 * fantomas * use RuntimeInformation.FrameworkDescription Co-authored-by: Kevin Ransom (msft) --- src/Compiler/Driver/FxResolver.fs | 224 ++++++-------------- src/Compiler/Facilities/CompilerLocation.fs | 1 + 2 files changed, 70 insertions(+), 155 deletions(-) diff --git a/src/Compiler/Driver/FxResolver.fs b/src/Compiler/Driver/FxResolver.fs index d769b36678e..2fa595ee15b 100644 --- a/src/Compiler/Driver/FxResolver.fs +++ b/src/Compiler/Driver/FxResolver.fs @@ -386,124 +386,37 @@ type internal FxResolver // On coreclr it uses the deps.json file // // On-demand because (a) some FxResolver are ephemeral (b) we want to avoid recomputation - let tryRunningDotNetCoreTfm = - lazy - let file = - try - let asm = Assembly.GetEntryAssembly() - - match asm with - | Null -> "" - | NonNull asm -> - let depsJsonPath = Path.ChangeExtension(asm.Location, "deps.json") - - if FileSystem.FileExistsShim(depsJsonPath) then - use stream = FileSystem.OpenFileForReadShim(depsJsonPath) - stream.ReadAllText() - else - "" - with _ -> - // This is defensive coding, we don't expect this exception to happen - // NOTE: consider reporting this exception as a warning - "" + let tryGetRunningTfm = + let runningTfmOpt = + let getTfmNumber (v: string) = + let arr = v.Split([| '.' |], 3) + arr[0] + "." + arr[1] + + // Compute TFM from System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription + // System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription;; + // val it: string = ".NET 6.0.7" + // val it: string = ".NET Framework 4.8.4515.0" + let name = RuntimeInformation.FrameworkDescription + let arr = name.Split([| ' ' |], 3) + + match arr[0], arr[1] with + | ".NET", "Core" when arr.Length >= 3 -> Some("netcoreapp" + (getTfmNumber arr[2])) + + | ".NET", "Framework" when arr.Length >= 3 -> + if arr[ 2 ].StartsWith("4.8") then + Some "net48" + else + Some "net472" - let tfmPrefix = ".NETCoreApp,Version=v" - let pattern = "\"name\": \"" + tfmPrefix + | ".NET", "Native" -> None - let startPos = - let startPos = file.IndexOf(pattern, StringComparison.OrdinalIgnoreCase) + | ".NET", _ when arr.Length >= 2 -> Some("net" + (getTfmNumber arr[1])) - if startPos >= 0 then - startPos + pattern.Length - else - startPos + | _ -> None - let length = - if startPos >= 0 then - let ep = file.IndexOf("\"", startPos) - if ep >= 0 then ep - startPos else ep - else - -1 - - match startPos, length with - | -1, _ - | _, -1 -> - if isRunningOnCoreClr then - // Running on coreclr but no deps.json was deployed with the host so default to 6.0 - Some "net6.0" - else - // Running on desktop - None - | pos, length -> - // use value from the deps.json file - let suffix = file.Substring(pos, length) - - let prefix = - match Double.TryParse(suffix) with - | true, value when value < 5.0 -> "netcoreapp" - | _ -> "net" - - Some(prefix + suffix) - - let tryGetRunningDotNetCoreTfm () = tryRunningDotNetCoreTfm.Force() - - // Tries to figure out the tfm for the compiler instance on the Windows desktop - // On full clr it uses the mscorlib version number - let getRunningDotNetFrameworkTfm () = - let defaultMscorlibVersion = 4, 8, 3815, 0 - - let desktopProductVersionMonikers = - [| - // major, minor, build, revision, moniker - 4, 8, 3815, 0, "net48" - 4, 8, 3761, 0, "net48" - 4, 7, 3190, 0, "net472" - 4, 7, 3062, 0, "net472" - 4, 7, 2600, 0, "net471" - 4, 7, 2558, 0, "net471" - 4, 7, 2053, 0, "net47" - 4, 7, 2046, 0, "net47" - 4, 6, 1590, 0, "net462" - 4, 6, 57, 0, "net462" - 4, 6, 1055, 0, "net461" - 4, 6, 81, 0, "net46" - 4, 0, 30319, 34209, "net452" - 4, 0, 30319, 17020, "net452" - 4, 0, 30319, 18408, "net451" - 4, 0, 30319, 17929, "net45" - 4, 0, 30319, 1, "net4" - |] - - let majorPart, minorPart, buildPart, privatePart = - try - let attrOpt = - typeof.Assembly.GetCustomAttributes (typeof) - |> Seq.tryHead - - match attrOpt with - | Some attr -> - let fv = - (downcast attr: AssemblyFileVersionAttribute).Version.Split([| '.' |]) - |> Array.map (fun e -> Int32.Parse(e)) - - fv[0], fv[1], fv[2], fv[3] - | _ -> defaultMscorlibVersion - with _ -> - defaultMscorlibVersion - - // Get the ProductVersion of this framework compare with table compatible monikers - match - desktopProductVersionMonikers - |> Array.tryFind (fun (major, minor, build, revision, _) -> - (majorPart >= major) - && (minorPart >= minor) - && (buildPart >= build) - && (privatePart >= revision)) - with - | Some (_, _, _, _, moniker) -> moniker - | None -> - // no TFM could be found, assume latest stable? - "net48" + match runningTfmOpt with + | Some tfm -> tfm + | _ -> if isRunningOnCoreClr then "net7.0" else "net472" let trySdkRefsPackDirectory = lazy @@ -897,58 +810,59 @@ type internal FxResolver member _.GetTfmAndRid() = fxlock.AcquireLock(fun fxtok -> RequireFxResolverLock(fxtok, "assuming all member require lock") - // Interactive processes read their own configuration to find the running tfm - - let tfm = - if isInteractive then - match tryGetRunningDotNetCoreTfm () with - | Some tfm -> tfm - | _ -> getRunningDotNetFrameworkTfm () - else - let sdkDir = tryGetSdkDir () |> replayWarnings - - match sdkDir with - | Some dir -> - let dotnetConfigFile = Path.Combine(dir, "dotnet.runtimeconfig.json") - use stream = FileSystem.OpenFileForReadShim(dotnetConfigFile) - let dotnetConfig = stream.ReadAllText() - let pattern = "\"tfm\": \"" - let startPos = - dotnetConfig.IndexOf(pattern, StringComparison.OrdinalIgnoreCase) - + pattern.Length - - let endPos = dotnetConfig.IndexOf("\"", startPos) - let tfm = dotnetConfig[startPos .. endPos - 1] - //printfn "GetTfmAndRid, tfm = '%s'" tfm - tfm - | None -> - match tryGetRunningDotNetCoreTfm () with - | Some tfm -> tfm - | _ -> getRunningDotNetFrameworkTfm () + let runningTfm = tryGetRunningTfm + // Coreclr has mechanism for getting rid + // System.Runtime.InteropServices.RuntimeInformation.RuntimeIdentifier + // On Desktop framework compile it using osplatform+processarch+ // Computer valid dotnet-rids for this environment: // https://docs.microsoft.com/en-us/dotnet/core/rid-catalog // // Where rid is: win, win-x64, win-x86, osx-x64, linux-x64 etc ... let runningRid = - let processArchitecture = RuntimeInformation.ProcessArchitecture + let rid = + if isRunningOnCoreClr then + // Use reflection to get the value for rid + let rinfoType: Type option = + Option.ofObj ( + Type.GetType( + "System.Runtime.InteropServices.RuntimeInformation, System.Runtime.InteropServices.RuntimeInformation", + false + ) + ) + + let ridProperty: PropertyInfo option = + match rinfoType with + | None -> None + | Some t -> Option.ofObj (t.GetProperty("RuntimeIdentifier", BindingFlags.Public ||| BindingFlags.Static)) - let baseRid = - if RuntimeInformation.IsOSPlatform(OSPlatform.Windows) then - "win" - elif RuntimeInformation.IsOSPlatform(OSPlatform.OSX) then - "osx" + match ridProperty with + | None -> None + | Some p -> Some(string (p.GetValue(null))) else - "linux" + None + + match rid with + | Some rid -> rid + | None -> + let processArchitecture = RuntimeInformation.ProcessArchitecture + + let baseRid = + if RuntimeInformation.IsOSPlatform(OSPlatform.Windows) then + "win" + elif RuntimeInformation.IsOSPlatform(OSPlatform.OSX) then + "osx" + else + "linux" - match processArchitecture with - | Architecture.X64 -> baseRid + "-x64" - | Architecture.X86 -> baseRid + "-x86" - | Architecture.Arm64 -> baseRid + "-arm64" - | _ -> baseRid + "-arm" + match processArchitecture with + | Architecture.X64 -> baseRid + "-x64" + | Architecture.X86 -> baseRid + "-x86" + | Architecture.Arm64 -> baseRid + "-arm64" + | _ -> baseRid + "-arm" - tfm, runningRid) + runningTfm, runningRid) static member ClearStaticCaches() = desiredDotNetSdkVersionForDirectoryCache.Clear() diff --git a/src/Compiler/Facilities/CompilerLocation.fs b/src/Compiler/Facilities/CompilerLocation.fs index d222446b933..24141252ee8 100644 --- a/src/Compiler/Facilities/CompilerLocation.fs +++ b/src/Compiler/Facilities/CompilerLocation.fs @@ -123,6 +123,7 @@ module internal FSharpEnvironment = |] elif typeof.Assembly.GetName().Name = "System.Private.CoreLib" then [| + "net7.0" "net6.0" "net5.0" "netcoreapp3.1" From 3ae2acc2e04401a7a8f366b066bd5c3092c8fece Mon Sep 17 00:00:00 2001 From: Petr Date: Tue, 9 Aug 2022 20:40:29 +0200 Subject: [PATCH 10/51] Streamlining some dependencies around Microsoft.CodeAnalysis (#13637) * Streamlining dependencies around Microsoft.CodeAnalysis * Update --- eng/Versions.props | 2 +- .../FSharp.Test.Utilities.fsproj | 1 - tests/fsharp/FSharpSuite.Tests.fsproj | 4 +- .../src/FSharp.Editor/FSharp.Editor.fsproj | 2 - .../FSharp.LanguageService.fsproj | 2 - .../FSharp.PatternMatcher/BKTree.Builder.cs | 1 + .../CaseSensitiveComparison.cs | 311 ------------------ .../FSharp.PatternMatcher.csproj | 4 + .../src/FSharp.PatternMatcher/VersionStamp.cs | 253 -------------- .../tests/Salsa/VisualFSharp.Salsa.fsproj | 1 - .../UnitTests/VisualFSharp.UnitTests.fsproj | 2 - 11 files changed, 7 insertions(+), 576 deletions(-) delete mode 100644 vsintegration/src/FSharp.PatternMatcher/CaseSensitiveComparison.cs delete mode 100644 vsintegration/src/FSharp.PatternMatcher/VersionStamp.cs diff --git a/eng/Versions.props b/eng/Versions.props index 78c638a867e..f2b1e0e9570 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -124,7 +124,7 @@ $(RoslynVersion) $(RoslynVersion) $(RoslynVersion) - $(RoslynVersion) + $(RoslynVersion) $(RoslynVersion) $(RoslynVersion) 2.0.28 diff --git a/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj b/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj index 278ee438053..0cea852926e 100644 --- a/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj +++ b/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj @@ -59,7 +59,6 @@ - diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index 6e1daff174e..548ac9e390a 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -105,8 +105,7 @@ - + false @@ -119,7 +118,6 @@ - diff --git a/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj b/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj index 6af186bb999..3dedf85d8e8 100644 --- a/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj +++ b/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj @@ -152,11 +152,9 @@ - - diff --git a/vsintegration/src/FSharp.LanguageService/FSharp.LanguageService.fsproj b/vsintegration/src/FSharp.LanguageService/FSharp.LanguageService.fsproj index 49c902d7704..d247d927341 100644 --- a/vsintegration/src/FSharp.LanguageService/FSharp.LanguageService.fsproj +++ b/vsintegration/src/FSharp.LanguageService/FSharp.LanguageService.fsproj @@ -58,9 +58,7 @@ - - diff --git a/vsintegration/src/FSharp.PatternMatcher/BKTree.Builder.cs b/vsintegration/src/FSharp.PatternMatcher/BKTree.Builder.cs index 42926a67ac5..b05c1bc3453 100644 --- a/vsintegration/src/FSharp.PatternMatcher/BKTree.Builder.cs +++ b/vsintegration/src/FSharp.PatternMatcher/BKTree.Builder.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Utilities; using System; using System.Collections.Generic; diff --git a/vsintegration/src/FSharp.PatternMatcher/CaseSensitiveComparison.cs b/vsintegration/src/FSharp.PatternMatcher/CaseSensitiveComparison.cs deleted file mode 100644 index cfbfabd718f..00000000000 --- a/vsintegration/src/FSharp.PatternMatcher/CaseSensitiveComparison.cs +++ /dev/null @@ -1,311 +0,0 @@ -using Roslyn.Utilities; -using System; -using System.Diagnostics; -using System.Globalization; -using System.Reflection.Internal; -using System.Text; - -namespace Microsoft.CodeAnalysis.Utilities -{ - internal static class CaseInsensitiveComparison - { - // PERF: Cache a TextInfo for Unicode ToLower since this will be accessed very frequently - private static readonly TextInfo s_unicodeCultureTextInfo = GetUnicodeCulture().TextInfo; - - private static CultureInfo GetUnicodeCulture() - { - try - { - // We use the "en" culture to get the Unicode ToLower mapping, as it implements - // a much more recent Unicode version (6.0+) than the invariant culture (1.0), - // and it matches the Unicode version used for character categorization. - return new CultureInfo("en"); - } - catch (ArgumentException) // System.Globalization.CultureNotFoundException not on all platforms - { - // If "en" is not available, fall back to the invariant culture. Although it has bugs - // specific to the invariant culture (e.g. being version-locked to Unicode 1.0), at least - // we can rely on it being present on all platforms. - return CultureInfo.InvariantCulture; - } - } - - /// - /// ToLower implements the Unicode lowercase mapping - /// as described in ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt. - /// VB uses these mappings for case-insensitive comparison. - /// - /// - /// If is upper case, then this returns its Unicode lower case equivalent. Otherwise, is returned unmodified. - public static char ToLower(char c) - { - // PERF: This is a very hot code path in VB, optimize for ASCII - - // Perform a range check with a single compare by using unsigned arithmetic - if (unchecked((uint)(c - 'A')) <= ('Z' - 'A')) - { - return (char)(c | 0x20); - } - - if (c < 0xC0) // Covers ASCII (U+0000 - U+007F) and up to the next upper-case codepoint (Latin Capital Letter A with Grave) - { - return c; - } - - return ToLowerNonAscii(c); - } - - private static char ToLowerNonAscii(char c) - { - if (c == '\u0130') - { - // Special case Turkish I (LATIN CAPITAL LETTER I WITH DOT ABOVE) - // This corrects for the fact that the invariant culture only supports Unicode 1.0 - // and therefore does not "know about" this character. - return 'i'; - } - - return s_unicodeCultureTextInfo.ToLower(c); - } - - /// - /// This class seeks to perform the lowercase Unicode case mapping. - /// - private sealed class OneToOneUnicodeComparer : StringComparer - { - private static int CompareLowerUnicode(char c1, char c2) - { - return (c1 == c2) ? 0 : ToLower(c1) - ToLower(c2); - } - - public override int Compare(string str1, string str2) - { - if ((object)str1 == str2) - { - return 0; - } - - if ((object)str1 == null) - { - return -1; - } - - if ((object)str2 == null) - { - return 1; - } - - int len = Math.Min(str1.Length, str2.Length); - for (int i = 0; i < len; i++) - { - int ordDiff = CompareLowerUnicode(str1[i], str2[i]); - if (ordDiff != 0) - { - return ordDiff; - } - } - - // return the smaller string, or 0 if they are equal in length - return str1.Length - str2.Length; - } - - private static bool AreEqualLowerUnicode(char c1, char c2) - { - return c1 == c2 || ToLower(c1) == ToLower(c2); - } - - public override bool Equals(string str1, string str2) - { - if ((object)str1 == str2) - { - return true; - } - - if ((object)str1 == null || (object)str2 == null) - { - return false; - } - - if (str1.Length != str2.Length) - { - return false; - } - - for (int i = 0; i < str1.Length; i++) - { - if (!AreEqualLowerUnicode(str1[i], str2[i])) - { - return false; - } - } - - return true; - } - - public static bool EndsWith(string value, string possibleEnd) - { - if ((object)value == possibleEnd) - { - return true; - } - - if ((object)value == null || (object)possibleEnd == null) - { - return false; - } - - int i = value.Length - 1; - int j = possibleEnd.Length - 1; - - if (i < j) - { - return false; - } - - while (j >= 0) - { - if (!AreEqualLowerUnicode(value[i], possibleEnd[j])) - { - return false; - } - - i--; - j--; - } - - return true; - } - - public static bool StartsWith(string value, string possibleStart) - { - if ((object)value == possibleStart) - { - return true; - } - - if ((object)value == null || (object)possibleStart == null) - { - return false; - } - - if (value.Length < possibleStart.Length) - { - return false; - } - - for (int i = 0; i < possibleStart.Length; i++) - { - if (!AreEqualLowerUnicode(value[i], possibleStart[i])) - { - return false; - } - } - - return true; - } - - public override int GetHashCode(string str) - { - int hashCode = Hash.FnvOffsetBias; - - for (int i = 0; i < str.Length; i++) - { - hashCode = Hash.CombineFNVHash(hashCode, ToLower(str[i])); - } - - return hashCode; - } - } - - /// - /// Returns a StringComparer that compares strings according the VB identifier comparison rules. - /// - private static readonly OneToOneUnicodeComparer s_comparer = new OneToOneUnicodeComparer(); - - /// - /// Returns a StringComparer that compares strings according the VB identifier comparison rules. - /// - public static StringComparer Comparer => s_comparer; - - /// - /// Determines if two VB identifiers are equal according to the VB identifier comparison rules. - /// - /// First identifier to compare - /// Second identifier to compare - /// true if the identifiers should be considered the same. - public static bool Equals(string left, string right) => s_comparer.Equals(left, right); - - /// - /// Determines if the string 'value' end with string 'possibleEnd'. - /// - /// - /// - /// - public static bool EndsWith(string value, string possibleEnd) => OneToOneUnicodeComparer.EndsWith(value, possibleEnd); - - /// - /// Determines if the string 'value' starts with string 'possibleStart'. - /// - /// - /// - /// - public static bool StartsWith(string value, string possibleStart) => OneToOneUnicodeComparer.StartsWith(value, possibleStart); - - /// - /// Compares two VB identifiers according to the VB identifier comparison rules. - /// - /// First identifier to compare - /// Second identifier to compare - /// -1 if < , 1 if > , 0 if they are equal. - public static int Compare(string left, string right) => s_comparer.Compare(left, right); - - /// - /// Gets a case-insensitive hash code for VB identifiers. - /// - /// identifier to get the hash code for - /// The hash code for the given identifier - public static int GetHashCode(string value) - { - Debug.Assert(value != null); - - return s_comparer.GetHashCode(value); - } - - /// - /// Convert a string to lower case per Unicode - /// - /// - /// - public static string ToLower(string value) - { - if ((object)value == null) - return null; - - if (value.Length == 0) - return value; - - var pooledStrbuilder = PooledStringBuilder.GetInstance(); - StringBuilder builder = pooledStrbuilder.Builder; - - builder.Append(value); - ToLower(builder); - - return pooledStrbuilder.ToStringAndFree(); - } - - /// - /// In-place convert string in StringBuilder to lower case per Unicode rules - /// - /// - public static void ToLower(StringBuilder builder) - { - if (builder == null) - return; - - for (int i = 0; i < builder.Length; i++) - { - builder[i] = ToLower(builder[i]); - } - } - } -} diff --git a/vsintegration/src/FSharp.PatternMatcher/FSharp.PatternMatcher.csproj b/vsintegration/src/FSharp.PatternMatcher/FSharp.PatternMatcher.csproj index 5005944c7fa..20617fd7527 100644 --- a/vsintegration/src/FSharp.PatternMatcher/FSharp.PatternMatcher.csproj +++ b/vsintegration/src/FSharp.PatternMatcher/FSharp.PatternMatcher.csproj @@ -17,4 +17,8 @@ + + + + \ No newline at end of file diff --git a/vsintegration/src/FSharp.PatternMatcher/VersionStamp.cs b/vsintegration/src/FSharp.PatternMatcher/VersionStamp.cs deleted file mode 100644 index 5f27e306a0d..00000000000 --- a/vsintegration/src/FSharp.PatternMatcher/VersionStamp.cs +++ /dev/null @@ -1,253 +0,0 @@ -using Roslyn.Utilities; -using System; -using System.Diagnostics.Contracts; -using System.Threading; - -namespace Microsoft.CodeAnalysis -{ - /// - /// VersionStamp should be only used to compare versions returned by same API. - /// - internal struct VersionStamp : IEquatable, IObjectWritable - { - public static VersionStamp Default => default(VersionStamp); - - private const int GlobalVersionMarker = -1; - private const int InitialGlobalVersion = 10000; - - /// - /// global counter to avoid collision within same session. - /// it starts with a big initial number just for a clarity in debugging - /// - private static int s_globalVersion = InitialGlobalVersion; - - /// - /// time stamp - /// - private readonly DateTime _utcLastModified; - - /// - /// indicate whether there was a collision on same item - /// - private readonly int _localIncrement; - - /// - /// unique version in same session - /// - private readonly int _globalIncrement; - - private VersionStamp(DateTime utcLastModified) - : this(utcLastModified, 0) - { - } - - private VersionStamp(DateTime utcLastModified, int localIncrement) - { - _utcLastModified = utcLastModified; - _localIncrement = localIncrement; - _globalIncrement = GetNextGlobalVersion(); - } - - private VersionStamp(DateTime utcLastModified, int localIncrement, int globalIncrement) - { - _utcLastModified = utcLastModified; - _localIncrement = localIncrement; - _globalIncrement = globalIncrement; - } - - /// - /// Creates a new instance of a VersionStamp. - /// - public static VersionStamp Create() - { - return new VersionStamp(DateTime.UtcNow); - } - - /// - /// Creates a new instance of a version stamp based on the specified DateTime. - /// - public static VersionStamp Create(DateTime utcTimeLastModified) - { - return new VersionStamp(utcTimeLastModified); - } - - /// - /// compare two different versions and return either one of the versions if there is no collision, otherwise, create a new version - /// that can be used later to compare versions between different items - /// - public VersionStamp GetNewerVersion(VersionStamp version) - { - // * NOTE * - // in current design/implementation, there are 4 possible ways for a version to be created. - // - // 1. created from a file stamp (most likely by starting a new session). "increment" will have 0 as value - // 2. created by modifying existing item (text changes, project changes etc). - // "increment" will have either 0 or previous increment + 1 if there was a collision. - // 3. created from deserialization (probably by using persistent service). - // 4. created by accumulating versions of multiple items. - // - // and this method is the one that is responsible for #4 case. - - if (_utcLastModified > version._utcLastModified) - { - return this; - } - - if (_utcLastModified == version._utcLastModified) - { - var thisGlobalVersion = GetGlobalVersion(this); - var thatGlobalVersion = GetGlobalVersion(version); - - if (thisGlobalVersion == thatGlobalVersion) - { - // given versions are same one - return this; - } - - // mark it as global version - // global version can't be moved to newer version. - return new VersionStamp(_utcLastModified, (thisGlobalVersion > thatGlobalVersion) ? thisGlobalVersion : thatGlobalVersion, GlobalVersionMarker); - } - - return version; - } - - /// - /// Gets a new VersionStamp that is guaranteed to be newer than its base one - /// this should only be used for same item to move it to newer version - /// - public VersionStamp GetNewerVersion() - { - // global version can't be moved to newer version - Contract.Requires(_globalIncrement != GlobalVersionMarker); - - var now = DateTime.UtcNow; - var incr = (now == _utcLastModified) ? _localIncrement + 1 : 0; - - return new VersionStamp(now, incr); - } - - /// - /// Returns the serialized text form of the VersionStamp. - /// - public override string ToString() - { - // 'o' is the roundtrip format that captures the most detail. - return _utcLastModified.ToString("o") + "-" + _globalIncrement + "-" + _localIncrement; - } - - public override int GetHashCode() - { - return Hash.Combine(_utcLastModified.GetHashCode(), _localIncrement); - } - - public override bool Equals(object obj) - { - if (obj is VersionStamp) - { - return this.Equals((VersionStamp)obj); - } - - return false; - } - - public bool Equals(VersionStamp version) - { - if (_utcLastModified == version._utcLastModified) - { - return GetGlobalVersion(this) == GetGlobalVersion(version); - } - - return false; - } - - public static bool operator ==(VersionStamp left, VersionStamp right) - { - return left.Equals(right); - } - - public static bool operator !=(VersionStamp left, VersionStamp right) - { - return !left.Equals(right); - } - - /// - /// check whether given persisted version is re-usable - /// - internal static bool CanReusePersistedVersion(VersionStamp baseVersion, VersionStamp persistedVersion) - { - if (baseVersion == persistedVersion) - { - return true; - } - - // there was a collision, we can't use these - if (baseVersion._localIncrement != 0 || persistedVersion._localIncrement != 0) - { - return false; - } - - return baseVersion._utcLastModified == persistedVersion._utcLastModified; - } - - void IObjectWritable.WriteTo(ObjectWriter writer) - { - WriteTo(writer); - } - - internal void WriteTo(ObjectWriter writer) - { - writer.WriteInt64(_utcLastModified.ToBinary()); - writer.WriteInt32(_localIncrement); - writer.WriteInt32(_globalIncrement); - } - - internal static VersionStamp ReadFrom(ObjectReader reader) - { - var raw = reader.ReadInt64(); - var localIncrement = reader.ReadInt32(); - var globalIncrement = reader.ReadInt32(); - - return new VersionStamp(DateTime.FromBinary(raw), localIncrement, globalIncrement); - } - - private static int GetGlobalVersion(VersionStamp version) - { - // global increment < 0 means it is a global version which has its global increment in local increment - return version._globalIncrement >= 0 ? version._globalIncrement : version._localIncrement; - } - - private static int GetNextGlobalVersion() - { - // REVIEW: not sure what is best way to wrap it when it overflows. should I just throw or don't care. - // with 50ms (typing) as an interval for a new version, it gives more than 1 year before int32 to overflow. - // with 5ms as an interval, it gives more than 120 days before it overflows. - // since global version is only for per VS session, I think we don't need to worry about overflow. - // or we could use Int64 which will give more than a million years turn around even on 1ms interval. - - // this will let versions to be compared safely between multiple items - // without worrying about collision within same session - var globalVersion = Interlocked.Increment(ref VersionStamp.s_globalVersion); - - return globalVersion; - } - - /// - /// True if this VersionStamp is newer than the specified one. - /// - internal bool TestOnly_IsNewerThan(VersionStamp version) - { - if (_utcLastModified > version._utcLastModified) - { - return true; - } - - if (_utcLastModified == version._utcLastModified) - { - return GetGlobalVersion(this) > GetGlobalVersion(version); - } - - return false; - } - } -} \ No newline at end of file diff --git a/vsintegration/tests/Salsa/VisualFSharp.Salsa.fsproj b/vsintegration/tests/Salsa/VisualFSharp.Salsa.fsproj index 4b7ef972b0d..58862ce6747 100644 --- a/vsintegration/tests/Salsa/VisualFSharp.Salsa.fsproj +++ b/vsintegration/tests/Salsa/VisualFSharp.Salsa.fsproj @@ -48,7 +48,6 @@ - diff --git a/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj b/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj index abcae6d9074..542ec626ebd 100644 --- a/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj +++ b/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj @@ -165,9 +165,7 @@ - - From c8494ed5f6d4e9271d80f8b5025323d2949eefa8 Mon Sep 17 00:00:00 2001 From: Jon Fortescue Date: Wed, 17 Aug 2022 18:03:14 -0700 Subject: [PATCH 11/51] Switch to new images on dev/17.4 (#13719) --- azure-pipelines.yml | 2 +- eng/release/insert-into-vs.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c25ca214b70..998ad5c9110 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -105,7 +105,7 @@ stages: - job: Full_Signed pool: name: NetCore1ESPool-Svc-Internal - demands: ImageOverride -equals Build.Windows.Amd64.VS2022 + demands: ImageOverride -equals windows.vs2022.amd64 timeoutInMinutes: 300 variables: - group: DotNet-Blob-Feed diff --git a/eng/release/insert-into-vs.yml b/eng/release/insert-into-vs.yml index b662b913366..63973516ba8 100644 --- a/eng/release/insert-into-vs.yml +++ b/eng/release/insert-into-vs.yml @@ -14,8 +14,8 @@ stages: jobs: - job: Insert_VS pool: - name: NetCore1ESPool-Internal - demands: ImageOverride -equals build.windows.10.amd64.vs2019 + name: NetCore1ESPool-Svc-Internal + demands: ImageOverride -equals windows.vs2019.amd64 variables: - group: DotNet-VSTS-Infra-Access - name: InsertAccessToken From 8e339bc4a7f2111823255cbcc1d3639853609440 Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Fri, 19 Aug 2022 13:16:20 +0200 Subject: [PATCH 12/51] Update xcopy-msbuild to fix signed builds (#13729) --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 1975051874d..e92180e8903 100644 --- a/global.json +++ b/global.json @@ -12,7 +12,7 @@ "Microsoft.VisualStudio.Component.FSharp" ] }, - "xcopy-msbuild": "17.1.0" + "xcopy-msbuild": "17.2.1" }, "native-tools": { "perl": "5.32.1.1" From 83988e26559e51366061af3f314dfc33cd152afd Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Wed, 24 Aug 2022 19:03:22 +0200 Subject: [PATCH 13/51] Update oneloc branch (#13773) --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 998ad5c9110..34dcb58e73c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -84,11 +84,11 @@ stages: # Signed build # #-------------------------------------------------------------------------------------------------------------------# - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/release/dev17.3') }}: + - ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/release/dev17.4') }}: - template: /eng/common/templates/job/onelocbuild.yml parameters: MirrorRepo: fsharp - MirrorBranch: release/dev17.3 + MirrorBranch: release/dev17.4 LclSource: lclFilesfromPackage LclPackageId: 'LCL-JUNO-PROD-FSHARP' - template: /eng/common/templates/jobs/jobs.yml From 3d99a9aea8b7d6e9f368539b582570ab4afa194d Mon Sep 17 00:00:00 2001 From: Matt Galbraith Date: Thu, 25 Aug 2022 06:23:49 -0700 Subject: [PATCH 14/51] Move to -Svc pool provider in release branches (#13779) --- azure-pipelines.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 34dcb58e73c..6a35cc45c69 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -210,7 +210,7 @@ stages: - name: _SignType value: Test pool: - name: NetCore1ESPool-Public + name: NetCore1ESPool-Svc-Public demands: ImageOverride -equals $(WindowsMachineQueueName) timeoutInMinutes: 90 steps: @@ -283,7 +283,7 @@ stages: # WindowsMachineQueueName=Windows.vs2022.amd64.open # and there is an alternate build definition that sets this to a queue that is always scouting the # next preview of Visual Studio. - name: NetCore1ESPool-Public + name: NetCore1ESPool-Svc-Public demands: ImageOverride -equals $(WindowsMachineQueueName) timeoutInMinutes: 120 strategy: @@ -337,7 +337,7 @@ stages: # Mock official build - job: MockOfficial pool: - name: NetCore1ESPool-Public + name: NetCore1ESPool-Svc-Public demands: ImageOverride -equals $(WindowsMachineQueueName) steps: - checkout: self @@ -428,7 +428,7 @@ stages: # End to end build - job: EndToEndBuildTests pool: - name: NetCore1ESPool-Public + name: NetCore1ESPool-Svc-Public demands: ImageOverride -equals $(WindowsMachineQueueName) steps: - checkout: self @@ -453,7 +453,7 @@ stages: # Plain build Windows - job: Plain_Build_Windows pool: - name: NetCore1ESPool-Public + name: NetCore1ESPool-Svc-Public demands: ImageOverride -equals $(WindowsMachineQueueName) variables: - name: _BuildConfig From 508a0b2d452ff123eaf9a882b7fe54a9d5e8e1ad Mon Sep 17 00:00:00 2001 From: Matt Galbraith Date: Mon, 29 Aug 2022 13:01:54 -0700 Subject: [PATCH 15/51] Missed a spot when updating to -Svc pool provider (#13807) --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 116511a26c2..f8fc6e98321 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -341,7 +341,7 @@ stages: # WindowsMachineQueueName=Windows.vs2022.amd64.open # and there is an alternate build definition that sets this to a queue that is always scouting the # next preview of Visual Studio. - name: NetCore1ESPool-Public + name: NetCore1ESPool-Svc-Public demands: ImageOverride -equals $(WindowsMachineQueueName) timeoutInMinutes: 120 strategy: From ea0d0b20ebf338b2eef75e82ac9888f9f5df9b4e Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Tue, 30 Aug 2022 13:03:14 -0700 Subject: [PATCH 16/51] Merge main to release/dev17.4 (#13808) * Revert tools.sh edit (#13796) * Revert tools.sh edit * Add binlog to build.sh for proto stuff * Verify ship status (#13793) * Verify ship status * -verifypackageshipstatus in the right place * more * Update Versions.props * Update azure-pipelines.yml * reactivate test - Help is displayed correctly (#13792) * tcconfig/tcconfigbuilder * add --bufferwidth * fantomas * oops Co-authored-by: Vlad Zarytovskii Co-authored-by: Kevin Ransom (msft) Co-authored-by: Vlad Zarytovskii --- .../checkpackages/Directory.Build.props | 9 ++++ .../checkpackages/Directory.Build.targets | 2 + .../FSharp.Compiler.Service_notshipped.fsproj | 23 ++++++++++ .../FSharp.Core_notshipped.fsproj | 17 ++++++++ buildtools/checkpackages/Nuget.Config | 6 +++ eng/Build.ps1 | 40 +++++++++++++++++ eng/build.sh | 17 +++++--- eng/common/tools.sh | 2 +- src/Compiler/Driver/CompilerConfig.fs | 4 ++ src/Compiler/Driver/CompilerConfig.fsi | 5 +++ src/Compiler/Driver/CompilerOptions.fs | 43 ++++++++++++------- src/Compiler/Driver/CompilerOptions.fsi | 2 +- src/Compiler/Interactive/fsi.fs | 2 +- .../ConsoleOnlyOptionsTests.fs | 26 ++++++----- .../expected-help-output.bsl | 16 +++---- .../fsc/help/help40.437.1033.bsl | 16 +++---- .../fsi/exename/help40.437.1033.bsl | 12 +++--- .../fsi/help/help40-nologo.437.1033.bsl | 12 +++--- .../fsi/help/help40.437.1033.bsl | 12 +++--- 19 files changed, 193 insertions(+), 73 deletions(-) create mode 100644 buildtools/checkpackages/Directory.Build.props create mode 100644 buildtools/checkpackages/Directory.Build.targets create mode 100644 buildtools/checkpackages/FSharp.Compiler.Service_notshipped.fsproj create mode 100644 buildtools/checkpackages/FSharp.Core_notshipped.fsproj create mode 100644 buildtools/checkpackages/Nuget.Config diff --git a/buildtools/checkpackages/Directory.Build.props b/buildtools/checkpackages/Directory.Build.props new file mode 100644 index 00000000000..8d7a02870f8 --- /dev/null +++ b/buildtools/checkpackages/Directory.Build.props @@ -0,0 +1,9 @@ + + + true + $(MSBuildProjectDirectory)\..\..\artifacts\tmp\$([System.Guid]::NewGuid()) + $(CachePath)\obj\ + $(CachePath)\http_cache + $(CachePath)\nuget_cache + + diff --git a/buildtools/checkpackages/Directory.Build.targets b/buildtools/checkpackages/Directory.Build.targets new file mode 100644 index 00000000000..8c119d5413b --- /dev/null +++ b/buildtools/checkpackages/Directory.Build.targets @@ -0,0 +1,2 @@ + + diff --git a/buildtools/checkpackages/FSharp.Compiler.Service_notshipped.fsproj b/buildtools/checkpackages/FSharp.Compiler.Service_notshipped.fsproj new file mode 100644 index 00000000000..f5204fd5c67 --- /dev/null +++ b/buildtools/checkpackages/FSharp.Compiler.Service_notshipped.fsproj @@ -0,0 +1,23 @@ + + + + + + net7.0 + true + $(MSBuildProjectDirectory)\..\..\artifacts\tmp\$([System.Guid]::NewGuid()) + $(CachePath)\bin + $(CachePath)\obj + $(CachePath)\http_cache + $(CachePath)\nuget_cache + + + + https://api.nuget.org/v3/index.json + + + + + + + diff --git a/buildtools/checkpackages/FSharp.Core_notshipped.fsproj b/buildtools/checkpackages/FSharp.Core_notshipped.fsproj new file mode 100644 index 00000000000..5942f999fd8 --- /dev/null +++ b/buildtools/checkpackages/FSharp.Core_notshipped.fsproj @@ -0,0 +1,17 @@ + + + + + + net7.0 + + + + https://api.nuget.org/v3/index.json + + + + + + + diff --git a/buildtools/checkpackages/Nuget.Config b/buildtools/checkpackages/Nuget.Config new file mode 100644 index 00000000000..1094c738a28 --- /dev/null +++ b/buildtools/checkpackages/Nuget.Config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eng/Build.ps1 b/eng/Build.ps1 index af103f7911a..347dce1afe8 100644 --- a/eng/Build.ps1 +++ b/eng/Build.ps1 @@ -63,6 +63,7 @@ param ( [switch]$sourceBuild, [switch]$skipBuild, [switch]$compressAllMetadata, + [switch]$verifypackageshipstatus = $false, [parameter(ValueFromRemainingArguments = $true)][string[]]$properties) Set-StrictMode -version 2.0 @@ -117,6 +118,7 @@ function Print-Usage() { Write-Host " -sourceBuild Simulate building for source-build." Write-Host " -skipbuild Skip building product" Write-Host " -compressAllMetadata Build product with compressed metadata" + Write-Host " -verifypackageshipstatus Verify whether the packages we are building have already shipped to nuget" Write-Host "" Write-Host "Command line arguments starting with '/p:' are passed through to MSBuild." } @@ -149,6 +151,7 @@ function Process-Arguments() { $script:testFSharpQA = $False $script:testVs = $False $script:testpack = $False + $script:verifypackageshipstatus = $True } if ($noRestore) { @@ -175,6 +178,10 @@ function Process-Arguments() { $script:compressAllMetadata = $True; } + if ($verifypackageshipstatus) { + $script:verifypackageshipstatus = $True; + } + foreach ($property in $properties) { if (!$property.StartsWith("/p:", "InvariantCultureIgnoreCase")) { Write-Host "Invalid argument: $property" @@ -605,6 +612,39 @@ try { throw "Error Verifying nupkgs have access to the source code" } + $verifypackageshipstatusFailed = $false + if ($verifypackageshipstatus) { + $dotnetPath = InitializeDotNetCli + $dotnetExe = Join-Path $dotnetPath "dotnet.exe" + + Write-Host "================================================================================================================================" + Write-Host "The error messages below are expected = They mean that FSharp.Core and FSharp.Compiler.Service are not yet published " + Write-Host "================================================================================================================================" + $exitCode = Exec-Process "$dotnetExe" "restore $RepoRoot\buildtools\checkpackages\FSharp.Compiler.Service_notshipped.fsproj" + if ($exitCode -eq 0) { + Write-Host -ForegroundColor Red "Command succeeded but was expected to fail: this means that the fsharp.compiler.service nuget package is already published" + Write-Host -ForegroundColor Red "Modify the version number of FSharp.Compiler.Servoce to be published" + $verifypackageshipstatusFailed = $True + } + + $exitCode = Exec-Process "$dotnetExe" "restore $RepoRoot\buildtools\checkpackages\FSharp.Core_notshipped.fsproj" + if ($exitCode -eq 0) { + Write-Host -ForegroundColor Red "Command succeeded but was expected to fail: this means that the fsharp.core nuget package is already published" + Write-Host -ForegroundColor Red "Modify the version number of FSharp.Compiler.Servoce to be published" + $verifypackageshipstatusFailed = $True + } + if (-not $verifypackageshipstatusFailed) + { + Write-Host "================================================================================================================================" + Write-Host "The error messages above are expected = They mean that FSharp.Core and FSharp.Compiler.Service are not yet published " + Write-Host "================================================================================================================================" + } + else + { + throw "Error Verifying shipping status of shipping nupkgs" + } + } + ExitWithExitCode 0 } catch { diff --git a/eng/build.sh b/eng/build.sh index de535261296..fff8414b3ef 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -255,21 +255,24 @@ function BuildSolution { rm -fr $bootstrap_dir fi if [ ! -f "$bootstrap_dir/fslex.dll" ]; then + local bltools="" + if [[ "$bl" != "" ]]; then + bltools=$bl+".lex.binlog" + fi BuildMessage="Error building tools" - MSBuild "$repo_root/buildtools/buildtools.proj" \ - /restore \ - /p:Configuration=$bootstrap_config + MSBuild "$repo_root/buildtools/buildtools.proj" /restore "$bltools" /p:Configuration=$bootstrap_config mkdir -p "$bootstrap_dir" cp -pr $artifacts_dir/bin/fslex/$bootstrap_config/net7.0 $bootstrap_dir/fslex cp -pr $artifacts_dir/bin/fsyacc/$bootstrap_config/net7.0 $bootstrap_dir/fsyacc fi if [ ! -f "$bootstrap_dir/fsc.exe" ]; then + local bltools="" + if [[ "$bl" != "" ]]; then + bltools=$bl+".bootstrap.binlog" + fi BuildMessage="Error building bootstrap" - MSBuild "$repo_root/Proto.sln" \ - /restore \ - /p:Configuration=$bootstrap_config - + MSBuild "$repo_root/Proto.sln" /restore "$bltools" /p:Configuration=$bootstrap_config cp -pr $artifacts_dir/bin/fsc/$bootstrap_config/net7.0 $bootstrap_dir/fsc fi fi diff --git a/eng/common/tools.sh b/eng/common/tools.sh index a5fed41b644..c110d0ed410 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -490,7 +490,7 @@ function MSBuild-Core { } } - RunBuildTool "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci /bl "$@" + RunBuildTool "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci "$@" } ResolvePath "${BASH_SOURCE[0]}" diff --git a/src/Compiler/Driver/CompilerConfig.fs b/src/Compiler/Driver/CompilerConfig.fs index 7a957b722da..cb0dc5478ee 100644 --- a/src/Compiler/Driver/CompilerConfig.fs +++ b/src/Compiler/Driver/CompilerConfig.fs @@ -551,6 +551,8 @@ type TcConfigBuilder = mutable fxResolver: FxResolver option + mutable bufferWidth: int option + // Is F# Interactive using multi-assembly emit? mutable fsiMultiAssemblyEmit: bool @@ -741,6 +743,7 @@ type TcConfigBuilder = shadowCopyReferences = false useSdkRefs = true fxResolver = None + bufferWidth = None fsiMultiAssemblyEmit = true internalTestSpanStackReferring = false noConditionalErasure = false @@ -1163,6 +1166,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = errorRecovery e range0 [] + member _.bufferWidth = data.bufferWidth member _.fsiMultiAssemblyEmit = data.fsiMultiAssemblyEmit member _.FxResolver = data.FxResolver member _.primaryAssembly = data.primaryAssembly diff --git a/src/Compiler/Driver/CompilerConfig.fsi b/src/Compiler/Driver/CompilerConfig.fsi index 461298b5d60..034e514d3c2 100644 --- a/src/Compiler/Driver/CompilerConfig.fsi +++ b/src/Compiler/Driver/CompilerConfig.fsi @@ -452,6 +452,8 @@ type TcConfigBuilder = mutable fxResolver: FxResolver option + mutable bufferWidth: int option + mutable fsiMultiAssemblyEmit: bool rangeForErrors: range @@ -746,6 +748,7 @@ type TcConfig = member alwaysCallVirt: bool member noDebugAttributes: bool + member useReflectionFreeCodeGen: bool /// If true, indicates all type checking and code generation is in the context of fsi.exe @@ -753,6 +756,8 @@ type TcConfig = member isInvalidationSupported: bool + member bufferWidth: int option + /// Indicates if F# Interactive is using single-assembly emit via Reflection.Emit, where internals are available. member fsiMultiAssemblyEmit: bool diff --git a/src/Compiler/Driver/CompilerOptions.fs b/src/Compiler/Driver/CompilerOptions.fs index b1408411311..e75a449c9e2 100644 --- a/src/Compiler/Driver/CompilerOptions.fs +++ b/src/Compiler/Driver/CompilerOptions.fs @@ -115,23 +115,27 @@ let compilerOptionUsage (CompilerOption (s, tag, spec, _, _)) = let nl = Environment.NewLine -let getCompilerOption (CompilerOption (_s, _tag, _spec, _, help) as compilerOption) = +let getCompilerOption (CompilerOption (_s, _tag, _spec, _, help) as compilerOption) width = let sb = StringBuilder() let flagWidth = 42 // fixed width for printing of flags, e.g. --debug:{full|pdbonly|portable|embedded} let defaultLineWidth = 80 // the fallback width let lineWidth = - try - Console.BufferWidth - with e -> - defaultLineWidth + match width with + | None -> + try + Console.BufferWidth + with _ -> + defaultLineWidth + | Some w -> w let lineWidth = if lineWidth = 0 then defaultLineWidth else - lineWidth (* Have seen BufferWidth=0 on Linux/Mono *) + lineWidth (* Have seen BufferWidth=0 on Linux/Mono Coreclr for sure *) + // Lines have this form: // flagWidth chars - for flags description or padding on continuation lines. // single space - space. @@ -159,14 +163,14 @@ let getCompilerOption (CompilerOption (_s, _tag, _spec, _, help) as compilerOpti let _ = sb.Append $"{nl}" sb.ToString() -let getPublicOptions (heading, opts) = - if not (isNil opts) then - $"{nl}{nl}\t\t{heading}{nl}" - + (opts |> List.map getCompilerOption |> String.concat "") - else - "" +let getPublicOptions heading opts width = + match opts with + | [] -> "" + | _ -> + $"{nl}{nl} {heading}{nl}" + + (opts |> List.map (fun t -> getCompilerOption t width) |> String.concat "") -let GetCompilerOptionBlocks blocks = +let GetCompilerOptionBlocks blocks width = let sb = new StringBuilder() let publicBlocks = @@ -182,7 +186,7 @@ let GetCompilerOptionBlocks blocks = let headingOptions = publicBlocks |> List.filter (fun (h2, _) -> heading = h2) |> List.collect snd - let _ = sb.Append(getPublicOptions (heading, headingOptions)) + let _ = sb.Append(getPublicOptions heading headingOptions width) Set.add heading doneHeadings List.fold consider Set.empty publicBlocks |> ignore> @@ -1462,6 +1466,14 @@ let internalFlags (tcConfigB: TcConfigBuilder) = None ) + CompilerOption( + "bufferwidth", + tagNone, + OptionInt((fun v -> tcConfigB.bufferWidth <- Some v)), + Some(InternalCommandLineOption("--bufferWidth", rangeCmdArgs)), + None + ) + CompilerOption( "detuple", tagNone, @@ -1997,7 +2009,8 @@ let GetBannerText tcConfigB = /// FSC only help. (FSI has it's own help function). let GetHelpFsc tcConfigB (blocks: CompilerOptionBlock list) = - GetBannerText tcConfigB + GetCompilerOptionBlocks blocks + + GetBannerText tcConfigB + GetCompilerOptionBlocks blocks tcConfigB.bufferWidth let GetVersion tcConfigB = $"{tcConfigB.productNameForBannerText}{nl}" diff --git a/src/Compiler/Driver/CompilerOptions.fsi b/src/Compiler/Driver/CompilerOptions.fsi index 048bffb51e9..8164393eac4 100644 --- a/src/Compiler/Driver/CompilerOptions.fsi +++ b/src/Compiler/Driver/CompilerOptions.fsi @@ -43,7 +43,7 @@ and CompilerOptionBlock = | PublicOptions of heading: string * options: CompilerOption list | PrivateOptions of options: CompilerOption list -val GetCompilerOptionBlocks: CompilerOptionBlock list -> string +val GetCompilerOptionBlocks: CompilerOptionBlock list -> width: int option -> string val DumpCompilerOptionBlocks: CompilerOptionBlock list -> unit // for QA diff --git a/src/Compiler/Interactive/fsi.fs b/src/Compiler/Interactive/fsi.fs index 00794953c27..316dfd429bb 100644 --- a/src/Compiler/Interactive/fsi.fs +++ b/src/Compiler/Interactive/fsi.fs @@ -885,7 +885,7 @@ type internal FsiCommandLineOptions(fsi: FsiEvaluationSessionHostConfig, Console.Write (GetBannerText tcConfigB) fprintfn fsiConsoleOutput.Out "" fprintfn fsiConsoleOutput.Out "%s" (FSIstrings.SR.fsiUsage(executableFileNameWithoutExtension.Value)) - Console.Write (GetCompilerOptionBlocks blocks) + Console.Write (GetCompilerOptionBlocks blocks tcConfigB.bufferWidth) exit 0 // option tags diff --git a/tests/FSharp.Compiler.Service.Tests/ConsoleOnlyOptionsTests.fs b/tests/FSharp.Compiler.Service.Tests/ConsoleOnlyOptionsTests.fs index 332c5cbdee7..b91c0cff0a5 100644 --- a/tests/FSharp.Compiler.Service.Tests/ConsoleOnlyOptionsTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ConsoleOnlyOptionsTests.fs @@ -5,27 +5,25 @@ module FSharp.Compiler.Service.Tests.ConsoleOnlyOptionsTests open System open System.IO open FSharp.Compiler.CompilerOptions +open FSharp.Compiler.Text.Range open NUnit.Framework open TestDoubles [] -[] -let ``Help is displayed correctly`` () = - try - if System.Console.BufferWidth < 80 then - System.Console.BufferWidth <- 80 - with _ -> () +let ``fsc help text is displayed correctly`` () = - let builder = getArbitraryTcConfigBuilder() - builder.showBanner <- false // We don't need the banner - - let blocks = GetCoreFscCompilerOptions builder + let builder = getArbitraryTcConfigBuilder() + builder.showBanner <- false // We don't need the banner + builder.TurnWarningOff(rangeCmdArgs, "75") // We are going to use a test only flag + builder.bufferWidth <- Some 80 // Fixed width 80 + + let expectedHelp = File.ReadAllText $"{__SOURCE_DIRECTORY__}/expected-help-output.bsl" - let expectedHelp = File.ReadAllText $"{__SOURCE_DIRECTORY__}/expected-help-output.bsl" - let help = GetHelpFsc builder blocks + let blocks = GetCoreFscCompilerOptions builder + let help = GetHelpFsc builder blocks + let actualHelp = help.Replace("\r\n", Environment.NewLine) - let actualHelp = help.Replace("\r\n", Environment.NewLine) - Assert.AreEqual(expectedHelp, actualHelp, $"Console width: {System.Console.BufferWidth}\nExpected: {expectedHelp}\n Actual: {actualHelp}") |> ignore + Assert.AreEqual(expectedHelp, actualHelp, $"Expected: '{expectedHelp}'\n Actual: '{actualHelp}'") |> ignore [] let ``Version is displayed correctly`` () = diff --git a/tests/FSharp.Compiler.Service.Tests/expected-help-output.bsl b/tests/FSharp.Compiler.Service.Tests/expected-help-output.bsl index 6be21d85f3c..877a8bf6b4b 100644 --- a/tests/FSharp.Compiler.Service.Tests/expected-help-output.bsl +++ b/tests/FSharp.Compiler.Service.Tests/expected-help-output.bsl @@ -1,6 +1,6 @@  - - OUTPUT FILES - + - OUTPUT FILES - --out: Name of the output file (Short form: -o) --target:exe Build a console executable @@ -46,7 +46,7 @@ the specified file path. - - INPUT FILES - + - INPUT FILES - --reference: Reference an assembly (Short form: -r) --compilertool: Reference an assembly or directory @@ -54,7 +54,7 @@ form: -t) - - RESOURCES - + - RESOURCES - --win32icon: Specify a Win32 icon file (.ico) --win32res: Specify a Win32 resource file (.res) --win32manifest: Specify a Win32 manifest file @@ -67,7 +67,7 @@ name>[,public|private]] - - CODE GENERATION - + - CODE GENERATION - --debug[+|-] Emit debug information (Short form: -g) --debug:{full|pdbonly|portable|embedded} Specify debugging type: full, @@ -99,7 +99,7 @@ constructs using reflection - - ERRORS AND WARNINGS - + - ERRORS AND WARNINGS - --warnaserror[+|-] Report all warnings as errors --warnaserror[+|-]: Report specific warnings as errors --warn: Set a warning level (0-5) @@ -110,7 +110,7 @@ color - - LANGUAGE - + - LANGUAGE - --langversion:{?|version|latest|preview} Display the allowed values for language version, specify language version such as 'latest' or @@ -121,7 +121,7 @@ --mlcompatibility Ignore ML compatibility warnings - - MISCELLANEOUS - + - MISCELLANEOUS - --nologo Suppress compiler copyright message --version Display compiler version banner and exit @@ -130,7 +130,7 @@ --@ Read response file for more options - - ADVANCED - + - ADVANCED - --codepage: Specify the codepage used to read source files --utf8output Output messages in UTF-8 encoding 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 779ea3c45a3..29c0350665c 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl @@ -2,7 +2,7 @@ Microsoft (R) F# Compiler version 12.0.0.0 for F# 6.0 Copyright (c) Microsoft Corporation. All Rights Reserved. - - OUTPUT FILES - + - OUTPUT FILES - --out: Name of the output file (Short form: -o) --target:exe Build a console executable @@ -48,7 +48,7 @@ Copyright (c) Microsoft Corporation. All Rights Reserved. the specified file path. - - INPUT FILES - + - INPUT FILES - --reference: Reference an assembly (Short form: -r) --compilertool: Reference an assembly or directory @@ -56,7 +56,7 @@ Copyright (c) Microsoft Corporation. All Rights Reserved. form: -t) - - RESOURCES - + - RESOURCES - --win32icon: Specify a Win32 icon file (.ico) --win32res: Specify a Win32 resource file (.res) --win32manifest: Specify a Win32 manifest file @@ -69,7 +69,7 @@ Copyright (c) Microsoft Corporation. All Rights Reserved. name>[,public|private]] - - CODE GENERATION - + - CODE GENERATION - --debug[+|-] Emit debug information (Short form: -g) --debug:{full|pdbonly|portable|embedded} Specify debugging type: full, @@ -101,7 +101,7 @@ Copyright (c) Microsoft Corporation. All Rights Reserved. constructs using reflection - - ERRORS AND WARNINGS - + - ERRORS AND WARNINGS - --warnaserror[+|-] Report all warnings as errors --warnaserror[+|-]: Report specific warnings as errors --warn: Set a warning level (0-5) @@ -112,7 +112,7 @@ Copyright (c) Microsoft Corporation. All Rights Reserved. color - - LANGUAGE - + - LANGUAGE - --langversion:{?|version|latest|preview} Display the allowed values for language version, specify language version such as 'latest' or @@ -123,7 +123,7 @@ Copyright (c) Microsoft Corporation. All Rights Reserved. --mlcompatibility Ignore ML compatibility warnings - - MISCELLANEOUS - + - MISCELLANEOUS - --nologo Suppress compiler copyright message --version Display compiler version banner and exit @@ -132,7 +132,7 @@ Copyright (c) Microsoft Corporation. All Rights Reserved. --@ Read response file for more options - - ADVANCED - + - ADVANCED - --codepage: Specify the codepage used to read source files --utf8output Output messages in UTF-8 encoding 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 d916a6c2eba..0eddbd7e4c9 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsi/exename/help40.437.1033.bsl +++ b/tests/fsharpqa/Source/CompilerOptions/fsi/exename/help40.437.1033.bsl @@ -2,7 +2,7 @@ Usage: fsharpi [script.fsx []] - - INPUT FILES - + - INPUT FILES - --use: Use the given file on startup as initial input --load: #load the given file on startup @@ -16,7 +16,7 @@ Usage: fsharpi [script.fsx []] fsi.CommandLineArgs - - CODE GENERATION - + - CODE GENERATION - --debug[+|-] Emit debug information (Short form: -g) --debug:{full|pdbonly|portable|embedded} Specify debugging type: full, @@ -42,7 +42,7 @@ Usage: fsharpi [script.fsx []] constructs using reflection - - ERRORS AND WARNINGS - + - ERRORS AND WARNINGS - --warnaserror[+|-] Report all warnings as errors --warnaserror[+|-]: Report specific warnings as errors --warn: Set a warning level (0-5) @@ -53,7 +53,7 @@ Usage: fsharpi [script.fsx []] color - - LANGUAGE - + - LANGUAGE - --langversion:{?|version|latest|preview} Display the allowed values for language version, specify language version such as 'latest' or @@ -64,7 +64,7 @@ Usage: fsharpi [script.fsx []] --mlcompatibility Ignore ML compatibility warnings - - MISCELLANEOUS - + - MISCELLANEOUS - --nologo Suppress compiler copyright message --version Display compiler version banner and exit @@ -72,7 +72,7 @@ Usage: fsharpi [script.fsx []] form: -?) - - ADVANCED - + - ADVANCED - --codepage: Specify the codepage used to read source files --utf8output Output messages in UTF-8 encoding 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 906df1bcee4..4bd87bb194d 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 @@ -2,7 +2,7 @@ Usage: fsiAnyCpu [script.fsx []] - - INPUT FILES - + - INPUT FILES - --use: Use the given file on startup as initial input --load: #load the given file on startup @@ -16,7 +16,7 @@ Usage: fsiAnyCpu [script.fsx []] fsi.CommandLineArgs - - CODE GENERATION - + - CODE GENERATION - --debug[+|-] Emit debug information (Short form: -g) --debug:{full|pdbonly|portable|embedded} Specify debugging type: full, @@ -42,7 +42,7 @@ Usage: fsiAnyCpu [script.fsx []] constructs using reflection - - ERRORS AND WARNINGS - + - ERRORS AND WARNINGS - --warnaserror[+|-] Report all warnings as errors --warnaserror[+|-]: Report specific warnings as errors --warn: Set a warning level (0-5) @@ -53,7 +53,7 @@ Usage: fsiAnyCpu [script.fsx []] color - - LANGUAGE - + - LANGUAGE - --langversion:{?|version|latest|preview} Display the allowed values for language version, specify language version such as 'latest' or @@ -64,7 +64,7 @@ Usage: fsiAnyCpu [script.fsx []] --mlcompatibility Ignore ML compatibility warnings - - MISCELLANEOUS - + - MISCELLANEOUS - --nologo Suppress compiler copyright message --version Display compiler version banner and exit @@ -72,7 +72,7 @@ Usage: fsiAnyCpu [script.fsx []] form: -?) - - ADVANCED - + - ADVANCED - --codepage: Specify the codepage used to read source files --utf8output Output messages in UTF-8 encoding 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 87541384a88..b56c812cd0e 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40.437.1033.bsl +++ b/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40.437.1033.bsl @@ -4,7 +4,7 @@ Copyright (c) Microsoft Corporation. All Rights Reserved. Usage: fsiAnyCpu [script.fsx []] - - INPUT FILES - + - INPUT FILES - --use: Use the given file on startup as initial input --load: #load the given file on startup @@ -18,7 +18,7 @@ Usage: fsiAnyCpu [script.fsx []] fsi.CommandLineArgs - - CODE GENERATION - + - CODE GENERATION - --debug[+|-] Emit debug information (Short form: -g) --debug:{full|pdbonly|portable|embedded} Specify debugging type: full, @@ -44,7 +44,7 @@ Usage: fsiAnyCpu [script.fsx []] constructs using reflection - - ERRORS AND WARNINGS - + - ERRORS AND WARNINGS - --warnaserror[+|-] Report all warnings as errors --warnaserror[+|-]: Report specific warnings as errors --warn: Set a warning level (0-5) @@ -55,7 +55,7 @@ Usage: fsiAnyCpu [script.fsx []] color - - LANGUAGE - + - LANGUAGE - --langversion:{?|version|latest|preview} Display the allowed values for language version, specify language version such as 'latest' or @@ -66,7 +66,7 @@ Usage: fsiAnyCpu [script.fsx []] --mlcompatibility Ignore ML compatibility warnings - - MISCELLANEOUS - + - MISCELLANEOUS - --nologo Suppress compiler copyright message --version Display compiler version banner and exit @@ -74,7 +74,7 @@ Usage: fsiAnyCpu [script.fsx []] form: -?) - - ADVANCED - + - ADVANCED - --codepage: Specify the codepage used to read source files --utf8output Output messages in UTF-8 encoding From 5ede675191a92bebf141c014fff0d945074a7a42 Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Sat, 3 Sep 2022 00:33:32 +0200 Subject: [PATCH 17/51] Fix net481 templates missing TFM (#13826) Co-authored-by: Kevin Ransom (msft) --- .../ConsoleProject/Template/ConsoleApplication.fsproj | 2 +- .../ProjectTemplates/LibraryProject/Template/Library.fsproj | 2 +- .../ProjectTemplates/TutorialProject/Template/Tutorial.fsproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/ConsoleApplication.fsproj b/vsintegration/ProjectTemplates/ConsoleProject/Template/ConsoleApplication.fsproj index ee7baed3960..3ae67f491ec 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/ConsoleApplication.fsproj +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/ConsoleApplication.fsproj @@ -1,7 +1,7 @@ Exe -$if$ ($targetframeworkversion$ == 4.5) net45$endif$$if$ ($targetframeworkversion$ == 4.6) net46 $endif$$if$ ($targetframeworkversion$ == 4.6.1) net461 $endif$$if$ ($targetframeworkversion$ == 4.6.2) net462 $endif$$if$ ($targetframeworkversion$ == 4.7) net47 $endif$$if$ ($targetframeworkversion$ == 4.7.1) net471 $endif$$if$ ($targetframeworkversion$ == 4.7.2) net472 $endif$$if$ ($targetframeworkversion$ == 4.8) net48 $endif$ +$if$ ($targetframeworkversion$ == 4.5) net45$endif$$if$ ($targetframeworkversion$ == 4.6) net46 $endif$$if$ ($targetframeworkversion$ == 4.6.1) net461 $endif$$if$ ($targetframeworkversion$ == 4.6.2) net462 $endif$$if$ ($targetframeworkversion$ == 4.7) net47 $endif$$if$ ($targetframeworkversion$ == 4.7.1) net471 $endif$$if$ ($targetframeworkversion$ == 4.7.2) net472 $endif$$if$ ($targetframeworkversion$ == 4.8) net48 $endif$$if$ ($targetframeworkversion$ == 4.8.1) net481 $endif$ $if$ ($safeprojectname$ != $projectname$) $safeprojectname$ $endif$ 3390;$(WarnOn) diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/Library.fsproj b/vsintegration/ProjectTemplates/LibraryProject/Template/Library.fsproj index 736dff548d6..719360dbea3 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/Library.fsproj +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/Library.fsproj @@ -1,6 +1,6 @@ -$if$ ($targetframeworkversion$ == 4.5) net45$endif$$if$ ($targetframeworkversion$ == 4.6) net46 $endif$$if$ ($targetframeworkversion$ == 4.6.1) net461 $endif$$if$ ($targetframeworkversion$ == 4.6.2) net462 $endif$$if$ ($targetframeworkversion$ == 4.7) net47 $endif$$if$ ($targetframeworkversion$ == 4.7.1) net471 $endif$$if$ ($targetframeworkversion$ == 4.7.2) net472 $endif$$if$ ($targetframeworkversion$ == 4.8) net48 $endif$ +$if$ ($targetframeworkversion$ == 4.5) net45$endif$$if$ ($targetframeworkversion$ == 4.6) net46 $endif$$if$ ($targetframeworkversion$ == 4.6.1) net461 $endif$$if$ ($targetframeworkversion$ == 4.6.2) net462 $endif$$if$ ($targetframeworkversion$ == 4.7) net47 $endif$$if$ ($targetframeworkversion$ == 4.7.1) net471 $endif$$if$ ($targetframeworkversion$ == 4.7.2) net472 $endif$$if$ ($targetframeworkversion$ == 4.8) net48 $endif$$if$ ($targetframeworkversion$ == 4.8.1) net481 $endif$ $if$ ($safeprojectname$ != $projectname$) $safeprojectname$ $endif$ true 3390;$(WarnOn) diff --git a/vsintegration/ProjectTemplates/TutorialProject/Template/Tutorial.fsproj b/vsintegration/ProjectTemplates/TutorialProject/Template/Tutorial.fsproj index 83103261b80..85ca52724a5 100644 --- a/vsintegration/ProjectTemplates/TutorialProject/Template/Tutorial.fsproj +++ b/vsintegration/ProjectTemplates/TutorialProject/Template/Tutorial.fsproj @@ -1,7 +1,7 @@ Exe -$if$ ($targetframeworkversion$ == 4.5) net45$endif$$if$ ($targetframeworkversion$ == 4.6) net46 $endif$$if$ ($targetframeworkversion$ == 4.6.1) net461 $endif$$if$ ($targetframeworkversion$ == 4.6.2) net462 $endif$$if$ ($targetframeworkversion$ == 4.7) net47 $endif$$if$ ($targetframeworkversion$ == 4.7.1) net471 $endif$$if$ ($targetframeworkversion$ == 4.7.2) net472 $endif$$if$ ($targetframeworkversion$ == 4.8) net48 $endif$ +$if$ ($targetframeworkversion$ == 4.5) net45$endif$$if$ ($targetframeworkversion$ == 4.6) net46 $endif$$if$ ($targetframeworkversion$ == 4.6.1) net461 $endif$$if$ ($targetframeworkversion$ == 4.6.2) net462 $endif$$if$ ($targetframeworkversion$ == 4.7) net47 $endif$$if$ ($targetframeworkversion$ == 4.7.1) net471 $endif$$if$ ($targetframeworkversion$ == 4.7.2) net472 $endif$$if$ ($targetframeworkversion$ == 4.8) net48 $endif$$if$ ($targetframeworkversion$ == 4.8.1) net481 $endif$ $if$ ($safeprojectname$ != $projectname$) $safeprojectname$ $endif$ 3390;$(WarnOn) From 753fc58b631d7a5f7f0b085d4a3adb3b4d47c7e6 Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Mon, 5 Sep 2022 11:47:48 -0700 Subject: [PATCH 18/51] Localized file check-in by OneLocBuild Task: Build definition ID 499: Build ID 1964393 (#13776) Co-authored-by: Vlad Zarytovskii --- src/Compiler/xlf/FSComp.txt.cs.xlf | 2 +- src/Compiler/xlf/FSComp.txt.de.xlf | 2 +- src/Compiler/xlf/FSComp.txt.es.xlf | 2 +- src/Compiler/xlf/FSComp.txt.fr.xlf | 2 +- src/Compiler/xlf/FSComp.txt.it.xlf | 2 +- src/Compiler/xlf/FSComp.txt.ja.xlf | 2 +- src/Compiler/xlf/FSComp.txt.ko.xlf | 2 +- src/Compiler/xlf/FSComp.txt.pl.xlf | 2 +- src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 2 +- src/Compiler/xlf/FSComp.txt.ru.xlf | 2 +- src/Compiler/xlf/FSComp.txt.tr.xlf | 2 +- src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 2 +- src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index 2097d93eac4..cc763d55072 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Používá se ve vzájemně rekurzivních vazbách, v deklaracích vlastností a s několika omezeními u generických parametrů. + Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index 11a26276634..c20b2d13891 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Wird in gegenseitig rekursiven Bindungen, in Eigenschaftendeklarationen und bei mehreren Beschränkungen in Bezug auf generische Parameter verwendet. + Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index 98681bcd9b1..d6ca1d1e23c 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Se usa en enlaces mutuamente recursivos, en declaraciones de propiedad y con varias restricciones en parámetros genéricos. + Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index 5eba08a8603..2ebb357fcf4 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Utilisé dans les liaisons mutuellement récursives, dans les déclarations de propriété et avec plusieurs contraintes sur des paramètres génériques. + Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index b331fef5680..3dfb1f0f556 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Usata in binding ricorsivi reciproci, dichiarazioni di proprietà e con più vincoli su parametri generici. + Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index dcdf1edc9d2..8c5ded418ae 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - 相互に再帰的なバインディング、プロパティの宣言、およびジェネリック パラメーターの複数の制約に使用します。 + Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index a88ab838892..a9e535db00c 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - 상호 재귀적 바인딩과 속성 선언에 사용되며 제네릭 매개 변수의 여러 제약 조건과 함께 사용됩니다. + Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index f71dd1c78a7..56e0f52d752 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Używane w powiązaniach wzajemnie cyklicznych, deklaracjach właściwości oraz z wieloma ograniczeniami parametrów ogólnych. + Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 615985563b5..0b5520e63da 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Usado em associações mutualmente recursivas, em declarações de propriedade e em múltiplas restrições em parâmetros genéricos. + Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index d48f16b89f2..c99e2a7362d 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Используется во взаимно рекурсивных привязках, объявлениях свойств и с несколькими ограничениями для универсальных параметров. + Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index 5f9763a7403..a5b6a101582 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Karşılıklı yinelemeli bağlamalarda, özellik bildirimlerinde ve genel parametreler üzerinde birden çok kısıtlamayla kullanılır. + Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index e821d6299d1..5e186209732 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - 用于互相递归绑定、属性声明,并用于对泛型参数的多个约束。 + Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index 852c5be20d8..33b9fde69ba 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - 用於互相遞迴的繫結、屬性宣告,以及搭配泛型參數的多個條件約束。 + Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. From 5a5c0753246c5d45a3cb3cc4d637189cb9c4d60d Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Sat, 10 Sep 2022 21:25:01 -0700 Subject: [PATCH 19/51] Add name and depth fo the stackguard threads (#13859) (#13868) Co-authored-by: Don Syme Co-authored-by: Vlad Zarytovskii Co-authored-by: Don Syme Co-authored-by: Kevin Ransom (msft) --- src/Compiler/AbstractIL/ilwritepdb.fs | 2 +- src/Compiler/Checking/CheckBasics.fs | 2 +- .../Checking/CheckIncrementalClasses.fs | 2 +- src/Compiler/Checking/FindUnsolved.fs | 2 +- src/Compiler/Checking/PostInferenceChecks.fs | 2 +- src/Compiler/CodeGen/IlxGen.fs | 2 +- src/Compiler/Facilities/DiagnosticsLogger.fs | 4 ++-- src/Compiler/Facilities/DiagnosticsLogger.fsi | 2 +- src/Compiler/Optimize/DetupleArgs.fs | 2 +- .../Optimize/InnerLambdasToTopLevelFuncs.fs | 2 +- src/Compiler/Optimize/LowerCalls.fs | 2 +- src/Compiler/Optimize/LowerLocalMutables.fs | 2 +- src/Compiler/Optimize/LowerStateMachines.fs | 2 +- src/Compiler/Optimize/Optimizer.fs | 2 +- src/Compiler/TypedTree/TypedTreeOps.fs | 20 +++++++++---------- 15 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/Compiler/AbstractIL/ilwritepdb.fs b/src/Compiler/AbstractIL/ilwritepdb.fs index 52fc97a9776..715987a2ad1 100644 --- a/src/Compiler/AbstractIL/ilwritepdb.fs +++ b/src/Compiler/AbstractIL/ilwritepdb.fs @@ -1037,6 +1037,6 @@ let rec pushShadowedLocals (stackGuard: StackGuard) (localsToPush: PdbLocalVar[] // adding the text " (shadowed)" to the names of those with name conflicts. let unshadowScopes rootScope = // Avoid stack overflow when writing linearly nested scopes - let stackGuard = StackGuard(100) + let stackGuard = StackGuard(100, "ILPdbWriter.unshadowScopes") let result, _ = pushShadowedLocals stackGuard [||] rootScope result diff --git a/src/Compiler/Checking/CheckBasics.fs b/src/Compiler/Checking/CheckBasics.fs index ee42b425a3d..e6fb4014376 100644 --- a/src/Compiler/Checking/CheckBasics.fs +++ b/src/Compiler/Checking/CheckBasics.fs @@ -341,7 +341,7 @@ type TcFileState = { g = g amap = amap recUses = ValMultiMap<_>.Empty - stackGuard = StackGuard(TcStackGuardDepth) + stackGuard = StackGuard(TcStackGuardDepth, "TcFileState") createsGeneratedProvidedTypes = false thisCcu = thisCcu isScript = isScript diff --git a/src/Compiler/Checking/CheckIncrementalClasses.fs b/src/Compiler/Checking/CheckIncrementalClasses.fs index c5418132b8d..c58414dfb00 100644 --- a/src/Compiler/Checking/CheckIncrementalClasses.fs +++ b/src/Compiler/Checking/CheckIncrementalClasses.fs @@ -527,7 +527,7 @@ type IncrClassReprInfo = PostTransform = (fun _ -> None) PreInterceptBinding = None RewriteQuotations = true - StackGuard = StackGuard(TcClassRewriteStackGuardDepth) } expr + StackGuard = StackGuard(TcClassRewriteStackGuardDepth, "FixupIncrClassExprPhase2C") } expr type IncrClassConstructionBindingsPhase2C = | Phase2CBindings of IncrClassBindingGroup list diff --git a/src/Compiler/Checking/FindUnsolved.fs b/src/Compiler/Checking/FindUnsolved.fs index 754a6215206..3a3b8c9de89 100644 --- a/src/Compiler/Checking/FindUnsolved.fs +++ b/src/Compiler/Checking/FindUnsolved.fs @@ -285,7 +285,7 @@ let UnsolvedTyparsOfModuleDef g amap denv mdef extraAttribs = amap=amap denv=denv unsolved = [] - stackGuard = StackGuard(FindUnsolvedStackGuardDepth) } + stackGuard = StackGuard(FindUnsolvedStackGuardDepth, "UnsolvedTyparsOfModuleDef") } accModuleOrNamespaceDef cenv NoEnv mdef accAttribs cenv NoEnv extraAttribs List.rev cenv.unsolved diff --git a/src/Compiler/Checking/PostInferenceChecks.fs b/src/Compiler/Checking/PostInferenceChecks.fs index 031c5ae7991..41b4922a7d0 100644 --- a/src/Compiler/Checking/PostInferenceChecks.fs +++ b/src/Compiler/Checking/PostInferenceChecks.fs @@ -2615,7 +2615,7 @@ let CheckImplFile (g, amap, reportErrors, infoReader, internalsVisibleToPaths, v reportErrors = reportErrors boundVals = Dictionary<_, _>(100, HashIdentity.Structural) limitVals = Dictionary<_, _>(100, HashIdentity.Structural) - stackGuard = StackGuard(PostInferenceChecksStackGuardDepth) + stackGuard = StackGuard(PostInferenceChecksStackGuardDepth, "CheckImplFile") potentialUnboundUsesOfVals = Map.empty anonRecdTypes = StampMap.Empty usesQuotations = false diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 19f6de28fd1..e83d70fd7f0 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -11863,7 +11863,7 @@ type IlxAssemblyGenerator(amap: ImportMap, tcGlobals: TcGlobals, tcVal: Constrai intraAssemblyInfo = intraAssemblyInfo optionsOpt = None optimizeDuringCodeGen = (fun _flag expr -> expr) - stackGuard = StackGuard(IlxGenStackGuardDepth) + stackGuard = StackGuard(IlxGenStackGuardDepth, "IlxAssemblyGenerator") } /// Register a set of referenced assemblies with the ILX code generator diff --git a/src/Compiler/Facilities/DiagnosticsLogger.fs b/src/Compiler/Facilities/DiagnosticsLogger.fs index aebfd1cfd6e..4c82c5f445a 100644 --- a/src/Compiler/Facilities/DiagnosticsLogger.fs +++ b/src/Compiler/Facilities/DiagnosticsLogger.fs @@ -813,7 +813,7 @@ let internal languageFeatureNotSupportedInLibraryError (langFeature: LanguageFea error (Error(FSComp.SR.chkFeatureNotSupportedInLibrary (featureStr, suggestedVersionStr), m)) /// Guard against depth of expression nesting, by moving to new stack when a maximum depth is reached -type StackGuard(maxDepth: int) = +type StackGuard(maxDepth: int, name: string) = let mutable depth = 1 @@ -828,7 +828,7 @@ type StackGuard(maxDepth: int) = async { do! Async.SwitchToNewThread() - Thread.CurrentThread.Name <- "F# Extra Compilation Thread" + Thread.CurrentThread.Name <- $"F# Extra Compilation Thread for {name} (depth {depth})" use _scope = new CompilationGlobalsScope(diagnosticsLogger, buildPhase) return f () } diff --git a/src/Compiler/Facilities/DiagnosticsLogger.fsi b/src/Compiler/Facilities/DiagnosticsLogger.fsi index c4f0b226e16..c3af3a7da9d 100644 --- a/src/Compiler/Facilities/DiagnosticsLogger.fsi +++ b/src/Compiler/Facilities/DiagnosticsLogger.fsi @@ -389,7 +389,7 @@ val tryLanguageFeatureErrorOption: val languageFeatureNotSupportedInLibraryError: langFeature: LanguageFeature -> m: range -> 'T type StackGuard = - new: maxDepth: int -> StackGuard + new: maxDepth: int * name: string -> StackGuard /// Execute the new function, on a new thread if necessary member Guard: f: (unit -> 'T) -> 'T diff --git a/src/Compiler/Optimize/DetupleArgs.fs b/src/Compiler/Optimize/DetupleArgs.fs index 4bdb5262a0f..dc2ea60f6e7 100644 --- a/src/Compiler/Optimize/DetupleArgs.fs +++ b/src/Compiler/Optimize/DetupleArgs.fs @@ -864,7 +864,7 @@ let passImplFile penv assembly = PreInterceptBinding = None PostTransform = postTransformExpr penv RewriteQuotations = false - StackGuard = StackGuard(DetupleRewriteStackGuardDepth) } + StackGuard = StackGuard(DetupleRewriteStackGuardDepth, "RewriteImplFile") } assembly |> RewriteImplFile rwenv //------------------------------------------------------------------------- diff --git a/src/Compiler/Optimize/InnerLambdasToTopLevelFuncs.fs b/src/Compiler/Optimize/InnerLambdasToTopLevelFuncs.fs index a4b3620b780..ed2097236fb 100644 --- a/src/Compiler/Optimize/InnerLambdasToTopLevelFuncs.fs +++ b/src/Compiler/Optimize/InnerLambdasToTopLevelFuncs.fs @@ -1366,7 +1366,7 @@ let MakeTopLevelRepresentationDecisions ccu g expr = recShortCallS = recShortCallS envPackM = envPackM fHatM = fHatM - stackGuard = StackGuard(InnerLambdasToTopLevelFunctionsStackGuardDepth) } + stackGuard = StackGuard(InnerLambdasToTopLevelFunctionsStackGuardDepth, "InnerLambdasToTopLevelFunctionsStackGuardDepth") } let z = Pass4_RewriteAssembly.rewriteState0 Pass4_RewriteAssembly.TransImplFile penv z expr diff --git a/src/Compiler/Optimize/LowerCalls.fs b/src/Compiler/Optimize/LowerCalls.fs index 5cf047f7e47..4fcbf9f36f1 100644 --- a/src/Compiler/Optimize/LowerCalls.fs +++ b/src/Compiler/Optimize/LowerCalls.fs @@ -49,5 +49,5 @@ let LowerImplFile g assembly = PreInterceptBinding=None PostTransform= (fun _ -> None) RewriteQuotations=false - StackGuard = StackGuard(LowerCallsRewriteStackGuardDepth) } + StackGuard = StackGuard(LowerCallsRewriteStackGuardDepth, "LowerCallsRewriteStackGuardDepth") } assembly |> RewriteImplFile rwenv diff --git a/src/Compiler/Optimize/LowerLocalMutables.fs b/src/Compiler/Optimize/LowerLocalMutables.fs index 320df36ce37..0899875242d 100644 --- a/src/Compiler/Optimize/LowerLocalMutables.fs +++ b/src/Compiler/Optimize/LowerLocalMutables.fs @@ -196,6 +196,6 @@ let TransformImplFile g amap implFile = PreInterceptBinding = Some(TransformBinding g heapValMap) PostTransform = (fun _ -> None) RewriteQuotations = true - StackGuard = StackGuard(AutoboxRewriteStackGuardDepth) } + StackGuard = StackGuard(AutoboxRewriteStackGuardDepth, "AutoboxRewriteStackGuardDepth") } diff --git a/src/Compiler/Optimize/LowerStateMachines.fs b/src/Compiler/Optimize/LowerStateMachines.fs index 31972252340..0f36b0db0e0 100644 --- a/src/Compiler/Optimize/LowerStateMachines.fs +++ b/src/Compiler/Optimize/LowerStateMachines.fs @@ -358,7 +358,7 @@ type LowerStateMachine(g: TcGlobals) = PostTransform = (fun _ -> None) PreInterceptBinding = None RewriteQuotations=true - StackGuard = StackGuard(LowerStateMachineStackGuardDepth) } + StackGuard = StackGuard(LowerStateMachineStackGuardDepth, "LowerStateMachineStackGuardDepth") } let ConvertStateMachineLeafExpression (env: env) expr = if sm_verbose then printfn "ConvertStateMachineLeafExpression for %A..." expr diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index 62e8078e8cb..fa965069205 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -4325,7 +4325,7 @@ let OptimizeImplFile (settings, ccu, tcGlobals, tcVal, importMap, optEnv, isIncr localInternalVals=Dictionary(10000) emitTailcalls=emitTailcalls casApplied=Dictionary() - stackGuard = StackGuard(OptimizerStackGuardDepth) + stackGuard = StackGuard(OptimizerStackGuardDepth, "OptimizerStackGuardDepth") } let env, _, _, _ as results = OptimizeImplFileInternal cenv optEnv isIncrementalFragment fsiMultiAssemblyEmit hidden mimpls diff --git a/src/Compiler/TypedTree/TypedTreeOps.fs b/src/Compiler/TypedTree/TypedTreeOps.fs index 8228d5782b4..b27b273160f 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.fs @@ -2209,7 +2209,7 @@ let CollectTypars = CollectTyparsAndLocals let CollectLocals = CollectTyparsAndLocals let CollectTyparsAndLocalsWithStackGuard() = - let stackGuard = StackGuard(AccFreeVarsStackGuardDepth) + let stackGuard = StackGuard(AccFreeVarsStackGuardDepth, "AccFreeVarsStackGuardDepth") CollectTyparsAndLocalsImpl (Some stackGuard) let CollectLocalsWithStackGuard() = CollectTyparsAndLocalsWithStackGuard() @@ -6248,31 +6248,31 @@ and remapImplFile ctxt compgen tmenv implFile = // Entry points let remapAttrib g tmenv attrib = - let ctxt = { g = g; stackGuard = StackGuard(RemapExprStackGuardDepth) } + let ctxt = { g = g; stackGuard = StackGuard(RemapExprStackGuardDepth, "RemapExprStackGuardDepth") } remapAttribImpl ctxt tmenv attrib let remapExpr g (compgen: ValCopyFlag) (tmenv: Remap) expr = - let ctxt = { g = g; stackGuard = StackGuard(RemapExprStackGuardDepth) } + let ctxt = { g = g; stackGuard = StackGuard(RemapExprStackGuardDepth, "RemapExprStackGuardDepth") } remapExprImpl ctxt compgen tmenv expr let remapPossibleForallTy g tmenv ty = - let ctxt = { g = g; stackGuard = StackGuard(RemapExprStackGuardDepth) } + let ctxt = { g = g; stackGuard = StackGuard(RemapExprStackGuardDepth, "RemapExprStackGuardDepth") } remapPossibleForallTyImpl ctxt tmenv ty let copyModuleOrNamespaceType g compgen mtyp = - let ctxt = { g = g; stackGuard = StackGuard(RemapExprStackGuardDepth) } + let ctxt = { g = g; stackGuard = StackGuard(RemapExprStackGuardDepth, "RemapExprStackGuardDepth") } copyAndRemapAndBindModTy ctxt compgen Remap.Empty mtyp |> fst let copyExpr g compgen e = - let ctxt = { g = g; stackGuard = StackGuard(RemapExprStackGuardDepth) } + let ctxt = { g = g; stackGuard = StackGuard(RemapExprStackGuardDepth, "RemapExprStackGuardDepth") } remapExprImpl ctxt compgen Remap.Empty e let copyImplFile g compgen e = - let ctxt = { g = g; stackGuard = StackGuard(RemapExprStackGuardDepth) } + let ctxt = { g = g; stackGuard = StackGuard(RemapExprStackGuardDepth, "RemapExprStackGuardDepth") } remapImplFile ctxt compgen Remap.Empty e |> fst let instExpr g tpinst e = - let ctxt = { g = g; stackGuard = StackGuard(RemapExprStackGuardDepth) } + let ctxt = { g = g; stackGuard = StackGuard(RemapExprStackGuardDepth, "RemapExprStackGuardDepth") } remapExprImpl ctxt CloneAll (mkInstRemap tpinst) e //-------------------------------------------------------------------------- @@ -7162,7 +7162,7 @@ let ExprFolder0 = type ExprFolders<'State> (folders: ExprFolder<'State>) = let mutable exprFClosure = Unchecked.defaultof<'State -> Expr -> 'State> // prevent reallocation of closure let mutable exprNoInterceptFClosure = Unchecked.defaultof<'State -> Expr -> 'State> // prevent reallocation of closure - let stackGuard = StackGuard(FoldExprStackGuardDepth) + let stackGuard = StackGuard(FoldExprStackGuardDepth, "FoldExprStackGuardDepth") let rec exprsF z xs = List.fold exprFClosure z xs @@ -9493,7 +9493,7 @@ and remapValToNonLocal ctxt tmenv inp = inp |> Construct.NewModifiedVal (remapValData ctxt tmenv) let ApplyExportRemappingToEntity g tmenv x = - let ctxt = { g = g; stackGuard = StackGuard(RemapExprStackGuardDepth) } + let ctxt = { g = g; stackGuard = StackGuard(RemapExprStackGuardDepth, "RemapExprStackGuardDepth") } remapTyconToNonLocal ctxt tmenv x (* Which constraints actually get compiled to .NET constraints? *) From 745a9ffc57e82f33c417f902c262fe47a54caf98 Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Wed, 14 Sep 2022 13:19:06 -0700 Subject: [PATCH 20/51] Introduce SynType.SignatureParameter. (#13879) (#13898) * Introduce SynType.SignatureParameter. * Add missing SynType cases in walkers. Co-authored-by: Florian Verdonck Co-authored-by: Vlad Zarytovskii --- src/Compiler/Checking/CheckExpressions.fs | 3 +- src/Compiler/Service/ServiceParseTreeWalk.fs | 9 ++- src/Compiler/Service/ServiceParsedInputOps.fs | 23 ++++-- src/Compiler/SyntaxTree/SyntaxTree.fs | 5 +- src/Compiler/SyntaxTree/SyntaxTree.fsi | 8 +++ src/Compiler/pars.fsy | 17 +++-- ...erService.SurfaceArea.netstandard.expected | 15 ++++ .../SyntaxTreeTests/SignatureTypeTests.fs | 41 +++++++++++ tests/service/SyntaxTreeTests/TypeTests.fs | 70 +++++++++++++++++++ .../service/SyntaxTreeTests/UnionCaseTests.fs | 29 +++++++- 10 files changed, 206 insertions(+), 14 deletions(-) diff --git a/src/Compiler/Checking/CheckExpressions.fs b/src/Compiler/Checking/CheckExpressions.fs index 50efadc072e..8b4b99a745e 100644 --- a/src/Compiler/Checking/CheckExpressions.fs +++ b/src/Compiler/Checking/CheckExpressions.fs @@ -4353,7 +4353,8 @@ and TcTypeOrMeasure kindOpt (cenv: cenv) newOk checkConstraints occ (iwsam: Warn | SynType.App(arg1, _, args, _, _, postfix, m) -> TcTypeMeasureApp kindOpt cenv newOk checkConstraints occ env tpenv arg1 args postfix m - | SynType.Paren(innerType, _) -> + | SynType.Paren(innerType, _) + | SynType.SignatureParameter(usedType = innerType) -> TcTypeOrMeasure kindOpt cenv newOk checkConstraints occ iwsam env tpenv innerType and CheckIWSAM (cenv: cenv) (env: TcEnv) checkConstraints iwsam m tcref = diff --git a/src/Compiler/Service/ServiceParseTreeWalk.fs b/src/Compiler/Service/ServiceParseTreeWalk.fs index 9a1a53ac658..9a4263d4975 100755 --- a/src/Compiler/Service/ServiceParseTreeWalk.fs +++ b/src/Compiler/Service/ServiceParseTreeWalk.fs @@ -823,8 +823,13 @@ module SyntaxTraversal = | SynType.MeasureDivide (ty1, ty2, _) -> [ ty1; ty2 ] |> List.tryPick (traverseSynType path) | SynType.Tuple (path = segments) -> getTypeFromTuplePath segments |> List.tryPick (traverseSynType path) | SynType.StaticConstantExpr (expr, _) -> traverseSynExpr [] expr - | SynType.Anon _ -> None - | _ -> None + | SynType.Paren (innerType = t) + | SynType.SignatureParameter (usedType = t) -> traverseSynType path t + | SynType.Anon _ + | SynType.AnonRecd _ + | SynType.LongIdent _ + | SynType.Var _ + | SynType.StaticConstant _ -> None visitor.VisitType(origPath, defaultTraverse, ty) diff --git a/src/Compiler/Service/ServiceParsedInputOps.fs b/src/Compiler/Service/ServiceParsedInputOps.fs index d41cef4a04b..7b1fc766c1d 100644 --- a/src/Compiler/Service/ServiceParsedInputOps.fs +++ b/src/Compiler/Service/ServiceParsedInputOps.fs @@ -669,8 +669,15 @@ module ParsedInput = | SynType.HashConstraint (t, _) -> walkType t | SynType.MeasureDivide (t1, t2, _) -> walkType t1 |> Option.orElseWith (fun () -> walkType t2) | SynType.MeasurePower (t, _, _) -> walkType t - | SynType.Paren (t, _) -> walkType t - | _ -> None + | SynType.Paren (t, _) + | SynType.SignatureParameter (usedType = t) -> walkType t + | SynType.StaticConstantExpr (e, _) -> walkExpr e + | SynType.StaticConstantNamed (ident, value, _) -> List.tryPick walkType [ ident; value ] + | SynType.Anon _ + | SynType.AnonRecd _ + | SynType.LongIdent _ + | SynType.Var _ + | SynType.StaticConstant _ -> None and walkClause clause = let (SynMatchClause (pat = pat; whenExpr = e1; resultExpr = e2)) = clause @@ -1661,7 +1668,8 @@ module ParsedInput = | SynType.Array (_, t, _) | SynType.HashConstraint (t, _) | SynType.MeasurePower (t, _, _) - | SynType.Paren (t, _) -> walkType t + | SynType.Paren (t, _) + | SynType.SignatureParameter (usedType = t) -> walkType t | SynType.Fun (argType = t1; returnType = t2) | SynType.MeasureDivide (t1, t2, _) -> walkType t1 @@ -1675,7 +1683,14 @@ module ParsedInput = | SynType.WithGlobalConstraints (t, typeConstraints, _) -> walkType t List.iter walkTypeConstraint typeConstraints - | _ -> () + | SynType.StaticConstantExpr (e, _) -> walkExpr e + | SynType.StaticConstantNamed (ident, value, _) -> + walkType ident + walkType value + | SynType.Anon _ + | SynType.AnonRecd _ + | SynType.Var _ + | SynType.StaticConstant _ -> () and walkClause (SynMatchClause (pat = pat; whenExpr = e1; resultExpr = e2)) = walkPat pat diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fs b/src/Compiler/SyntaxTree/SyntaxTree.fs index 8a0b853f63e..ce5571ab4d9 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fs +++ b/src/Compiler/SyntaxTree/SyntaxTree.fs @@ -435,6 +435,8 @@ type SynType = | Paren of innerType: SynType * range: range + | SignatureParameter of attributes: SynAttributes * optional: bool * id: Ident option * usedType: SynType * range: range + member x.Range = match x with | SynType.App (range = m) @@ -452,7 +454,8 @@ type SynType = | SynType.HashConstraint (range = m) | SynType.MeasureDivide (range = m) | SynType.MeasurePower (range = m) - | SynType.Paren (range = m) -> m + | SynType.Paren (range = m) + | SynType.SignatureParameter (range = m) -> m | SynType.LongIdent lidwd -> lidwd.Range [] diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fsi b/src/Compiler/SyntaxTree/SyntaxTree.fsi index 503a7b2faa7..2af399af0e4 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTree.fsi @@ -510,6 +510,14 @@ type SynType = | Paren of innerType: SynType * range: range + /// F# syntax: a: b, used in signatures and type annotations + | SignatureParameter of + attributes: SynAttributes * + optional: bool * + id: Ident option * + usedType: SynType * + range: range + /// Gets the syntax range of this construct member Range: range diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index c0453c0c80c..d7bbdaaf68e 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -5082,22 +5082,29 @@ topTupleTypeElements: topAppType: | attributes appType COLON appType { match $2 with - | SynType.LongIdent(SynLongIdent([id], _, _)) -> $4, SynArgInfo($1, false, Some id) + | SynType.LongIdent(SynLongIdent([id], _, _)) -> + let m = rhs2 parseState 1 4 + SynType.SignatureParameter($1, false, Some id, $4, m), SynArgInfo($1, false, Some id) | _ -> raiseParseErrorAt (rhs parseState 2) (FSComp.SR.parsSyntaxErrorInLabeledType()) } | attributes QMARK ident COLON appType - { $5, SynArgInfo($1, true, Some $3) } + { let m = rhs2 parseState 1 5 + SynType.SignatureParameter($1, true, Some $3, $5, m), SynArgInfo($1, true, Some $3) } | attributes appType - { ($2, SynArgInfo($1, false, None)) } + { let m = rhs2 parseState 1 2 + SynType.SignatureParameter($1, false, None, $2, m), SynArgInfo($1, false, None) } | appType COLON appType { match $1 with - | SynType.LongIdent(SynLongIdent([id], _, _)) -> $3, SynArgInfo([], false, Some id) + | SynType.LongIdent(SynLongIdent([id], _, _)) -> + let m = rhs2 parseState 1 3 + SynType.SignatureParameter([], false, Some id, $3, m), SynArgInfo([], false, Some id) | _ -> raiseParseErrorAt (rhs parseState 2) (FSComp.SR.parsSyntaxErrorInLabeledType()) } | QMARK ident COLON appType - { $4, SynArgInfo([], true, Some $2) } + { let m = rhs2 parseState 1 4 + SynType.SignatureParameter([], true, Some $2, $4, m), SynArgInfo([], true, Some $2) } | appType { $1, SynArgInfo([], false, None) } diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected b/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected index b808314ad58..083c2ea9310 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected @@ -8483,6 +8483,16 @@ FSharp.Compiler.Syntax.SynType+Paren: FSharp.Compiler.Syntax.SynType get_innerTy FSharp.Compiler.Syntax.SynType+Paren: FSharp.Compiler.Syntax.SynType innerType FSharp.Compiler.Syntax.SynType+Paren: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynType+Paren: FSharp.Compiler.Text.Range range +FSharp.Compiler.Syntax.SynType+SignatureParameter: Boolean get_optional() +FSharp.Compiler.Syntax.SynType+SignatureParameter: Boolean optional +FSharp.Compiler.Syntax.SynType+SignatureParameter: FSharp.Compiler.Syntax.SynType get_usedType() +FSharp.Compiler.Syntax.SynType+SignatureParameter: FSharp.Compiler.Syntax.SynType usedType +FSharp.Compiler.Syntax.SynType+SignatureParameter: FSharp.Compiler.Text.Range get_range() +FSharp.Compiler.Syntax.SynType+SignatureParameter: FSharp.Compiler.Text.Range range +FSharp.Compiler.Syntax.SynType+SignatureParameter: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList] attributes +FSharp.Compiler.Syntax.SynType+SignatureParameter: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList] get_attributes() +FSharp.Compiler.Syntax.SynType+SignatureParameter: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident] get_id() +FSharp.Compiler.Syntax.SynType+SignatureParameter: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident] id FSharp.Compiler.Syntax.SynType+StaticConstant: FSharp.Compiler.Syntax.SynConst constant FSharp.Compiler.Syntax.SynType+StaticConstant: FSharp.Compiler.Syntax.SynConst get_constant() FSharp.Compiler.Syntax.SynType+StaticConstant: FSharp.Compiler.Text.Range get_range() @@ -8508,6 +8518,7 @@ FSharp.Compiler.Syntax.SynType+Tags: Int32 LongIdentApp FSharp.Compiler.Syntax.SynType+Tags: Int32 MeasureDivide FSharp.Compiler.Syntax.SynType+Tags: Int32 MeasurePower FSharp.Compiler.Syntax.SynType+Tags: Int32 Paren +FSharp.Compiler.Syntax.SynType+Tags: Int32 SignatureParameter FSharp.Compiler.Syntax.SynType+Tags: Int32 StaticConstant FSharp.Compiler.Syntax.SynType+Tags: Int32 StaticConstantExpr FSharp.Compiler.Syntax.SynType+Tags: Int32 StaticConstantNamed @@ -8541,6 +8552,7 @@ FSharp.Compiler.Syntax.SynType: Boolean IsLongIdentApp FSharp.Compiler.Syntax.SynType: Boolean IsMeasureDivide FSharp.Compiler.Syntax.SynType: Boolean IsMeasurePower FSharp.Compiler.Syntax.SynType: Boolean IsParen +FSharp.Compiler.Syntax.SynType: Boolean IsSignatureParameter FSharp.Compiler.Syntax.SynType: Boolean IsStaticConstant FSharp.Compiler.Syntax.SynType: Boolean IsStaticConstantExpr FSharp.Compiler.Syntax.SynType: Boolean IsStaticConstantNamed @@ -8558,6 +8570,7 @@ FSharp.Compiler.Syntax.SynType: Boolean get_IsLongIdentApp() FSharp.Compiler.Syntax.SynType: Boolean get_IsMeasureDivide() FSharp.Compiler.Syntax.SynType: Boolean get_IsMeasurePower() FSharp.Compiler.Syntax.SynType: Boolean get_IsParen() +FSharp.Compiler.Syntax.SynType: Boolean get_IsSignatureParameter() FSharp.Compiler.Syntax.SynType: Boolean get_IsStaticConstant() FSharp.Compiler.Syntax.SynType: Boolean get_IsStaticConstantExpr() FSharp.Compiler.Syntax.SynType: Boolean get_IsStaticConstantNamed() @@ -8575,6 +8588,7 @@ FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewLongIdentApp(F FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewMeasureDivide(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewMeasurePower(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynRationalConst, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewParen(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewSignatureParameter(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList], Boolean, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident], FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewStaticConstant(FSharp.Compiler.Syntax.SynConst, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewStaticConstantExpr(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewStaticConstantNamed(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range) @@ -8592,6 +8606,7 @@ FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+LongIdentApp FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+MeasureDivide FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+MeasurePower FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+Paren +FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+SignatureParameter FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+StaticConstant FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+StaticConstantExpr FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+StaticConstantNamed diff --git a/tests/service/SyntaxTreeTests/SignatureTypeTests.fs b/tests/service/SyntaxTreeTests/SignatureTypeTests.fs index 943fa5ba5e3..e7f8055fee9 100644 --- a/tests/service/SyntaxTreeTests/SignatureTypeTests.fs +++ b/tests/service/SyntaxTreeTests/SignatureTypeTests.fs @@ -471,3 +471,44 @@ type Z with assertRange (14, 0) (14, 4) mType3 assertRange (14, 7) (14, 11) mWith3 | _ -> Assert.Fail $"Could not get valid AST, got {parseResults}" + +[] +let ``SynValSig contains parameter names`` () = + let parseResults = + getParseResultsOfSignatureFile + """ +module Meh +val InferSynValData: + memberFlagsOpt: SynMemberFlags option * pat: SynPat option * SynReturnInfo option * origRhsExpr: SynExpr -> + x: string -> + SynValData2 +""" + + match parseResults with + | ParsedInput.SigFile (ParsedSigFileInput (modules=[ + SynModuleOrNamespaceSig(decls=[ + SynModuleSigDecl.Val(valSig = SynValSig(synType = + SynType.Fun( + argType = + SynType.Tuple(path = [ + SynTupleTypeSegment.Type(SynType.SignatureParameter(id = Some memberFlagsOpt)) + SynTupleTypeSegment.Star _ + SynTupleTypeSegment.Type(SynType.SignatureParameter(id = Some pat)) + SynTupleTypeSegment.Star _ + SynTupleTypeSegment.Type(SynType.App _) + SynTupleTypeSegment.Star _ + SynTupleTypeSegment.Type(SynType.SignatureParameter(id = Some origRhsExpr)) + ]) + returnType = + SynType.Fun( + argType = SynType.SignatureParameter(id = Some x) + returnType = SynType.LongIdent _ + ) + ) + )) + ] ) ])) -> + Assert.AreEqual("memberFlagsOpt", memberFlagsOpt.idText) + Assert.AreEqual("pat", pat.idText) + Assert.AreEqual("origRhsExpr", origRhsExpr.idText) + Assert.AreEqual("x", x.idText) + | _ -> Assert.Fail $"Could not get valid AST, got {parseResults}" \ No newline at end of file diff --git a/tests/service/SyntaxTreeTests/TypeTests.fs b/tests/service/SyntaxTreeTests/TypeTests.fs index c38e684ada3..0c822ea94dc 100644 --- a/tests/service/SyntaxTreeTests/TypeTests.fs +++ b/tests/service/SyntaxTreeTests/TypeTests.fs @@ -524,3 +524,73 @@ let _: struct (int * int = () assertRange (2, 7) (2, 24) mTuple | _ -> Assert.Fail $"Could not get valid AST, got {parseResults}" + +[] +let ``Named parameters in delegate type`` () = + let parseResults = + getParseResults + """ +type Foo = delegate of a: A * b: B -> c:C -> D + """ + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput(modules = [ + SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Types(typeDefns = [ + SynTypeDefn(typeRepr = SynTypeDefnRepr.ObjectModel(kind = + SynTypeDefnKind.Delegate(signature = SynType.Fun( + argType = + SynType.Tuple(path = [ + SynTupleTypeSegment.Type(SynType.SignatureParameter(id = Some a)) + SynTupleTypeSegment.Star _ + SynTupleTypeSegment.Type(SynType.SignatureParameter(id = Some b)) + ]) + returnType = + SynType.Fun( + argType = SynType.SignatureParameter(id = Some c) + returnType = SynType.LongIdent _ + ) + )))) + ]) + ]) + ])) -> + Assert.AreEqual("a", a.idText) + Assert.AreEqual("b", b.idText) + Assert.AreEqual("c", c.idText) + | _ -> Assert.Fail $"Could not get valid AST, got {parseResults}" + +[] +let ``Attributes in optional named member parameter`` () = + let parseResults = + getParseResults + """ +type X = + abstract member Y: [] ?a: A -> B + """ + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput(modules = [ + SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Types(typeDefns = [ + SynTypeDefn(typeRepr = SynTypeDefnRepr.ObjectModel( + members = [ + SynMemberDefn.AbstractSlot(slotSig = SynValSig(synType = + SynType.Fun( + argType = SynType.SignatureParameter( + [ { Attributes = [ _ ; _ ] } ], + true, + Some a, + SynType.LongIdent _, + m + ) + returnType = SynType.LongIdent _ + ) + )) + ] + )) + ]) + ]) + ])) -> + Assert.AreEqual("a", a.idText) + assertRange (3, 23) (3, 41) m + | _ -> Assert.Fail $"Could not get valid AST, got {parseResults}" \ No newline at end of file diff --git a/tests/service/SyntaxTreeTests/UnionCaseTests.fs b/tests/service/SyntaxTreeTests/UnionCaseTests.fs index 2cb1f80b730..c9c480cc16e 100644 --- a/tests/service/SyntaxTreeTests/UnionCaseTests.fs +++ b/tests/service/SyntaxTreeTests/UnionCaseTests.fs @@ -135,4 +135,31 @@ type Currency = ])) -> assertRange (7, 4) (7, 11) mPrivate | _ -> - Assert.Fail "Could not get valid AST" \ No newline at end of file + Assert.Fail "Could not get valid AST" + +[] +let ``SynUnionCaseKind.FullType`` () = + let parseResults = + getParseResults + """ +type X = + | a: int * z:int + """ + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput(modules = [ + SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Types(typeDefns = [ + SynTypeDefn(typeRepr = SynTypeDefnRepr.Simple(simpleRepr = + SynTypeDefnSimpleRepr.Union(unionCases = [ + SynUnionCase(caseType = SynUnionCaseKind.FullType(fullType = SynType.Tuple(path = [ + SynTupleTypeSegment.Type(SynType.LongIdent _) + SynTupleTypeSegment.Star _ + SynTupleTypeSegment.Type(SynType.SignatureParameter(id = Some z)) + ]))) + ]))) + ]) + ]) + ])) -> + Assert.AreEqual("z", z.idText) + | _ -> Assert.Fail $"Could not get valid AST, got {parseResults}" \ No newline at end of file From c706dcc522c65aae19d36c0901352e3ae3954f88 Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Thu, 15 Sep 2022 05:34:52 -0700 Subject: [PATCH 21/51] Localized file check-in by OneLocBuild Task: Build definition ID 499: Build ID 1994213 (#13908) --- src/Compiler/xlf/FSComp.txt.cs.xlf | 2 +- src/Compiler/xlf/FSComp.txt.de.xlf | 2 +- src/Compiler/xlf/FSComp.txt.es.xlf | 2 +- src/Compiler/xlf/FSComp.txt.fr.xlf | 2 +- src/Compiler/xlf/FSComp.txt.it.xlf | 2 +- src/Compiler/xlf/FSComp.txt.ja.xlf | 2 +- src/Compiler/xlf/FSComp.txt.ko.xlf | 2 +- src/Compiler/xlf/FSComp.txt.pl.xlf | 2 +- src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 60 ++++++++++++------------- src/Compiler/xlf/FSComp.txt.ru.xlf | 60 ++++++++++++------------- src/Compiler/xlf/FSComp.txt.tr.xlf | 2 +- src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 2 +- src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 2 +- src/Compiler/xlf/FSStrings.pt-BR.xlf | 2 +- src/Compiler/xlf/FSStrings.ru.xlf | 2 +- 15 files changed, 73 insertions(+), 73 deletions(-) diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index f7ca5a364e8..8a1853a380f 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -7544,7 +7544,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Používá se ve vzájemně rekurzivních vazbách, v deklaracích vlastností a s několika omezeními u generických parametrů. diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index d3bbe7b5812..e96c8e1d3b2 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -7544,7 +7544,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Wird in gegenseitig rekursiven Bindungen, in Eigenschaftendeklarationen und bei mehreren Beschränkungen in Bezug auf generische Parameter verwendet. diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index 27eecc1cea5..8c034062331 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -7544,7 +7544,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Se usa en enlaces mutuamente recursivos, en declaraciones de propiedad y con varias restricciones en parámetros genéricos. diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index 7aded9c6213..ab6345e8e0c 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -7544,7 +7544,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Utilisé dans les liaisons mutuellement récursives, dans les déclarations de propriété et avec plusieurs contraintes sur des paramètres génériques. diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 218756d3dbd..85a4a4cd333 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -7544,7 +7544,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Usata in binding ricorsivi reciproci, dichiarazioni di proprietà e con più vincoli su parametri generici. diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index 8fb9f4199d1..1a49a44350e 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -7544,7 +7544,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + 相互に再帰的なバインディング、プロパティの宣言、およびジェネリック パラメーターの複数の制約に使用します。 diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 517ab655d41..1a4cb6964d8 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -7544,7 +7544,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + 상호 재귀적 바인딩과 속성 선언에 사용되며 제네릭 매개 변수의 여러 제약 조건과 함께 사용됩니다. diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index 06bd965bdc7..1cc8dfb88f1 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -7544,7 +7544,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Używane w powiązaniach wzajemnie cyklicznych, deklaracjach właściwości oraz z wieloma ograniczeniami parametrów ogólnych. diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 668c9cbdb49..8b1a949bfba 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -189,12 +189,12 @@ static abstract interface members - static abstract interface members + membros de interface abstrata estática support for consuming init properties - support for consuming init properties + suporte para consumir propriedades de inicialização @@ -204,7 +204,7 @@ Allow lowercase DU when RequireQualifiedAccess attribute - Allow lowercase DU when RequireQualifiedAccess attribute + Permitir DU em minúsculas quando o atributo RequireQualifiedAccess @@ -269,7 +269,7 @@ support for required properties - support for required properties + suporte para propriedades necessárias @@ -279,7 +279,7 @@ self type constraints - self type constraints + restrições de auto-tipo @@ -329,7 +329,7 @@ The '%A' format specifier may not be used in an assembly being compiled with option '--reflectionfree'. This construct implicitly uses reflection. - The '%A' format specifier may not be used in an assembly being compiled with option '--reflectionfree'. This construct implicitly uses reflection. + O especificador de formato '%A' não pode ser usado em um assembly que está sendo compilado com a opção '--reflectionfree'. Esse constructo usa implicitamente reflexão. @@ -374,7 +374,7 @@ Used to check if an object is of the given type in a pattern or binding. - Used to check if an object is of the given type in a pattern or binding. + Usado para verificar se um objeto é do tipo fornecido em um padrão ou associação. @@ -474,12 +474,12 @@ Compress interface and optimization data files - Compress interface and optimization data files + Compactar arquivos de dados de otimização e interface Display the allowed values for language version. - Display the allowed values for language version. + Exiba os valores permitidos para a versão do idioma. @@ -494,12 +494,12 @@ Specify included optimization information, the default is file. Important for distributed libraries. - Specify included optimization information, the default is file. Important for distributed libraries. + Especifique as informações de otimização incluídas, o padrão é o file. Importante para bibliotecas distribuídas. The pdb output file name cannot match the build output filename use --pdb:filename.pdb - The pdb output file name cannot match the build output filename use --pdb:filename.pdb + O nome do arquivo de saída pdb não pode corresponder ao nome do arquivo de saída do build. Use --pdb:filename.pdb @@ -514,17 +514,17 @@ Disable implicit generation of constructs using reflection - Disable implicit generation of constructs using reflection + Desabilitar a geração implícita de constructos usando reflexão Specify language version such as 'latest' or 'preview'. - Specify language version such as 'latest' or 'preview'. + Especifique a versão do idioma, como 'última versão' ou 'versão prévia'. Include F# interface information, the default is file. Essential for distributing libraries. - Include F# interface information, the default is file. Essential for distributing libraries. + Inclua informações da interface F#, o padrão é file. Essencial para distribuir bibliotecas. @@ -534,12 +534,12 @@ Invalid value '{0}' for --optimizationdata, valid value are: none, file, compress. - Invalid value '{0}' for --optimizationdata, valid value are: none, file, compress. + Valor inválido '{0}' para --optimizationdata, o valor válido é: none, file, compact. Invalid value '{0}' for --interfacedata, valid value are: none, file, compress. - Invalid value '{0}' for --interfacedata, valid value are: none, file, compress. + Valor inválido '{0}' para --interfacedata, o valor válido é: none, file, compact. @@ -594,12 +594,12 @@ Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) - Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) + Literal de caractere incompleto (exemplo: 'Q') ou invocação de tipo qualificado (exemplo: 'T.Name) Incomplete operator expression (example a^b) or qualified type invocation (example: ^T.Name) - Incomplete operator expression (example a^b) or qualified type invocation (example: ^T.Name) + Expressão de operador incompleta (exemplo a^b) ou invocação de tipo qualificado (exemplo: ^T.Name) @@ -784,7 +784,7 @@ Init-only property '{0}' cannot be set outside the initialization code. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization - Init-only property '{0}' cannot be set outside the initialization code. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization + A propriedade somente inicialização '{0}' não pode ser definida fora do código de inicialização. Confira https://aka.ms/fsharp-assigning-values-to-properties-at-initialization @@ -814,7 +814,7 @@ Invalid constraint. Valid constraint forms include \"'T :> ISomeInterface\" for interface constraints and \"SomeConstrainingType<'T>\" for self-constraints. See https://aka.ms/fsharp-type-constraints. - Invalid constraint. Valid constraint forms include \"'T :> ISomeInterface\" for interface constraints and \"SomeConstrainingType<'T>\" for self-constraints. See https://aka.ms/fsharp-type-constraints. + Restrição inválida. Os formulários de restrição válidos incluem \"'T :> ISomeInterface\" para restrições de interface e \"SomeConstrainingType<'T>\" para auto-restrições. Confira https://aka.ms/fsharp-type-constraints. @@ -859,7 +859,7 @@ The following required properties have to be initalized:{0} - The following required properties have to be initalized:{0} + As seguintes propriedades necessárias precisam ser inicializadas:{0} @@ -944,7 +944,7 @@ Cannot call '{0}' - a setter for init-only property, please use object initialization instead. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization - Cannot call '{0}' - a setter for init-only property, please use object initialization instead. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization + Não é possível chamar '{0}' – um setter da propriedade somente inicialização, use a inicialização de objeto. Confira https://aka.ms/fsharp-assigning-values-to-properties-at-initialization @@ -954,27 +954,27 @@ The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. - The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. + A característica '{0}' invocada por essa chamada tem vários tipos de suporte. Essa sintaxe de invocação não é permitida para essas características. Confira https://aka.ms/fsharp-srtp para obter as diretrizes. Invocation of a static constraint should use \"'T.Ident\" and not \"^T.Ident\", even for statically resolved type parameters. - Invocation of a static constraint should use \"'T.Ident\" and not \"^T.Ident\", even for statically resolved type parameters. + A invocação de uma restrição estática deve usar \"'T.Ident\" e não \"^T.Ident\", mesmo para parâmetros de tipo resolvidos estaticamente. Trait '{0}' is not static - Trait '{0}' is not static + A característica '{0}' não é estática Trait '{0}' is static - Trait '{0}' is static + A característica '{0}' é estática A trait may not specify optional, in, out, ParamArray, CallerInfo or Quote arguments - A trait may not specify optional, in, out, ParamArray, CallerInfo or Quote arguments + Uma característica não pode especificar os argumentos optional, in, out, ParamArray, CallerInfo ou Quote @@ -984,12 +984,12 @@ '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. - '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. + '{0}' normalmente é usado como uma restrição de tipo em código genérico, por exemplo, \"'T when ISomeInterface<'T>\" ou \"let f (x: #ISomeInterface<_>)\". Confira https://aka.ms/fsharp-iwsams para obter as diretrizes. Você pode desabilitar este aviso usando '#nowarn \"3536\"' ou '--nowarn:3536'. Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. - Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. + Declarando \"interfaces com métodos abstratos estáticos\" é um recurso avançado. Consulte https://aka.ms/fsharp-iwsams para obter diretrizes. Você pode desabilitar esse aviso usando '#nowarn \"3535\"' ou '--nowarn:3535'. @@ -7544,7 +7544,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Usado em associações mutualmente recursivas, em declarações de propriedade e em múltiplas restrições em parâmetros genéricos. diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index 53c05f79d84..577563a8b62 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -189,12 +189,12 @@ static abstract interface members - static abstract interface members + статические абстрактные элементы интерфейса support for consuming init properties - support for consuming init properties + поддержка использования свойств инициализации @@ -204,7 +204,7 @@ Allow lowercase DU when RequireQualifiedAccess attribute - Allow lowercase DU when RequireQualifiedAccess attribute + Разрешить du в нижнем регистре, если атрибут RequireQualifiedAccess @@ -269,7 +269,7 @@ support for required properties - support for required properties + поддержка обязательных свойств @@ -279,7 +279,7 @@ self type constraints - self type constraints + ограничения самостоятельного типа @@ -329,7 +329,7 @@ The '%A' format specifier may not be used in an assembly being compiled with option '--reflectionfree'. This construct implicitly uses reflection. - The '%A' format specifier may not be used in an assembly being compiled with option '--reflectionfree'. This construct implicitly uses reflection. + Определитель формата "%A" нельзя использовать в сборке, компилируемой с параметром "--reflectionfree". Эта конструкция неявно использует отражение. @@ -374,7 +374,7 @@ Used to check if an object is of the given type in a pattern or binding. - Used to check if an object is of the given type in a pattern or binding. + Используется для проверки принадлежности объекта заданному типу в шаблоне или привязке. @@ -474,12 +474,12 @@ Compress interface and optimization data files - Compress interface and optimization data files + Сжатие файлов данных интерфейса и оптимизации Display the allowed values for language version. - Display the allowed values for language version. + Отображение допустимых значений для версии языка. @@ -494,12 +494,12 @@ Specify included optimization information, the default is file. Important for distributed libraries. - Specify included optimization information, the default is file. Important for distributed libraries. + Укажите включенные сведения об оптимизации, по умолчанию это файл. Необходимо для распределенных библиотек. The pdb output file name cannot match the build output filename use --pdb:filename.pdb - The pdb output file name cannot match the build output filename use --pdb:filename.pdb + Имя выходного файла pdb не может совпадать с именем выходного файла сборки. Используйте --pdb:filename.pdb @@ -514,17 +514,17 @@ Disable implicit generation of constructs using reflection - Disable implicit generation of constructs using reflection + Отключить неявное создание конструкций с помощью отражения Specify language version such as 'latest' or 'preview'. - Specify language version such as 'latest' or 'preview'. + Укажите версию языка, например "новейшая" или "предварительная версия". Include F# interface information, the default is file. Essential for distributing libraries. - Include F# interface information, the default is file. Essential for distributing libraries. + Включить сведения об интерфейсе F#, по умолчанию используется файл. Необходимо для распространения библиотек. @@ -534,12 +534,12 @@ Invalid value '{0}' for --optimizationdata, valid value are: none, file, compress. - Invalid value '{0}' for --optimizationdata, valid value are: none, file, compress. + Недопустимое значение "{0}" для --optimizationdata. Допустимые значения: none, file, compress. Invalid value '{0}' for --interfacedata, valid value are: none, file, compress. - Invalid value '{0}' for --interfacedata, valid value are: none, file, compress. + Недопустимое значение "{0}" для --interfacedata. Допустимые значения: none, file, compress. @@ -594,12 +594,12 @@ Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) - Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) + Неполный символьный литерал (например: "Q") или вызов квалифицированного типа (например: "T.Name) Incomplete operator expression (example a^b) or qualified type invocation (example: ^T.Name) - Incomplete operator expression (example a^b) or qualified type invocation (example: ^T.Name) + Неполное выражение оператора (например, a^b) или вызов квалифицированного типа (например, ^T.Name) @@ -784,7 +784,7 @@ Init-only property '{0}' cannot be set outside the initialization code. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization - Init-only property '{0}' cannot be set outside the initialization code. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization + Свойство только для инициализации "{0}" невозможно установить за пределами кода инициализации. См. https://aka.ms/fsharp-assigning-values-to-properties-at-initialization @@ -814,7 +814,7 @@ Invalid constraint. Valid constraint forms include \"'T :> ISomeInterface\" for interface constraints and \"SomeConstrainingType<'T>\" for self-constraints. See https://aka.ms/fsharp-type-constraints. - Invalid constraint. Valid constraint forms include \"'T :> ISomeInterface\" for interface constraints and \"SomeConstrainingType<'T>\" for self-constraints. See https://aka.ms/fsharp-type-constraints. + Недопустимое ограничение. Допустимые формы ограничения включают \"'T:> ISomeInterface\" для ограничений интерфейса и \"SomeConstrainingType<'T>\" для собственных ограничений. См. https://aka.ms/fsharp-type-constraints. @@ -859,7 +859,7 @@ The following required properties have to be initalized:{0} - The following required properties have to be initalized:{0} + Необходимо инициализировать следующие обязательные свойства:{0} @@ -944,7 +944,7 @@ Cannot call '{0}' - a setter for init-only property, please use object initialization instead. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization - Cannot call '{0}' - a setter for init-only property, please use object initialization instead. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization + Не удается вызвать '{0}' — установщик для свойства только для инициализации, вместо этого используйте инициализацию объекта. См. https://aka.ms/fsharp-assigning-values-to-properties-at-initialization. @@ -954,27 +954,27 @@ The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. - The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. + Признак "{0}", вызываемый этим звонком, имеет несколько типов поддержки. Этот синтаксис вызова не разрешен для таких признаков. См. руководство на https://aka.ms/fsharp-srtp. Invocation of a static constraint should use \"'T.Ident\" and not \"^T.Ident\", even for statically resolved type parameters. - Invocation of a static constraint should use \"'T.Ident\" and not \"^T.Ident\", even for statically resolved type parameters. + Вызов статического ограничения должен использовать \"'T.Ident\", а не \"^T.Ident\", даже для статически разрешенных параметров типа. Trait '{0}' is not static - Trait '{0}' is not static + Признак "{0}" не является статическим Trait '{0}' is static - Trait '{0}' is static + Признак "{0}" является статическим A trait may not specify optional, in, out, ParamArray, CallerInfo or Quote arguments - A trait may not specify optional, in, out, ParamArray, CallerInfo or Quote arguments + Признак не может указывать необязательные аргументы in, out, ParamArray, CallerInfo или Quote @@ -984,12 +984,12 @@ '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. - '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. + "{0}" обычно используется в качестве ограничения типа в универсальном коде, например \"'T when ISomeInterface<"T>\" или \"let f (x: #ISomeInterface<_>)\". См. руководство на https://aka.ms/fsharp-iwsams. Это предупреждение можно отключить с помощью "#nowarn \"3536\"" или "--nowarn:3536". Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. - Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. + Объявление \"интерфейсов со статическими абстрактными методами\" является расширенной функцией. См. руководство на https://aka.ms/fsharp-iwsams. Это предупреждение можно отключить с помощью используя "#nowarn \"3535\"" or "--nowarn:3535". @@ -7544,7 +7544,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Используется во взаимно рекурсивных привязках, объявлениях свойств и с несколькими ограничениями для универсальных параметров. diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index f7fc865a3a6..7ee5a8cb3bc 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -7544,7 +7544,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Karşılıklı yinelemeli bağlamalarda, özellik bildirimlerinde ve genel parametreler üzerinde birden çok kısıtlamayla kullanılır. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index a5f32d17a90..2659f03165a 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -7544,7 +7544,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + 用于互相递归绑定、属性声明,并用于对泛型参数的多个约束。 diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index 20a8448c73b..f7f06f543fc 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -7544,7 +7544,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + 用於互相遞迴的繫結、屬性宣告,以及搭配泛型參數的多個條件約束。 diff --git a/src/Compiler/xlf/FSStrings.pt-BR.xlf b/src/Compiler/xlf/FSStrings.pt-BR.xlf index 1929c486cda..a2f3f37cb39 100644 --- a/src/Compiler/xlf/FSStrings.pt-BR.xlf +++ b/src/Compiler/xlf/FSStrings.pt-BR.xlf @@ -9,7 +9,7 @@ Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute - Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + Os casos de união discriminados em letras minúsculas só são permitidos ao usar o atributo RequireQualifiedAccess diff --git a/src/Compiler/xlf/FSStrings.ru.xlf b/src/Compiler/xlf/FSStrings.ru.xlf index 1e91c13cd4c..a728823d325 100644 --- a/src/Compiler/xlf/FSStrings.ru.xlf +++ b/src/Compiler/xlf/FSStrings.ru.xlf @@ -9,7 +9,7 @@ Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute - Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + Размеченные в нижнем регистре случаи объединения разрешены только при использовании атрибута RequireQualifiedAccess From 6278c751c0b2fd68ee90c46b1ad631203c824a21 Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Wed, 21 Sep 2022 06:34:02 -0700 Subject: [PATCH 22/51] Localized file check-in by OneLocBuild Task: Build definition ID 499: Build ID 1998941 (#13941) Co-authored-by: Vlad Zarytovskii --- src/Compiler/xlf/FSComp.txt.cs.xlf | 58 ++++++++++++------------- src/Compiler/xlf/FSComp.txt.de.xlf | 58 ++++++++++++------------- src/Compiler/xlf/FSComp.txt.es.xlf | 58 ++++++++++++------------- src/Compiler/xlf/FSComp.txt.fr.xlf | 58 ++++++++++++------------- src/Compiler/xlf/FSComp.txt.it.xlf | 58 ++++++++++++------------- src/Compiler/xlf/FSComp.txt.ko.xlf | 58 ++++++++++++------------- src/Compiler/xlf/FSComp.txt.pl.xlf | 58 ++++++++++++------------- src/Compiler/xlf/FSComp.txt.tr.xlf | 58 ++++++++++++------------- src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 58 ++++++++++++------------- src/Compiler/xlf/FSStrings.cs.xlf | 2 +- src/Compiler/xlf/FSStrings.de.xlf | 2 +- src/Compiler/xlf/FSStrings.es.xlf | 2 +- src/Compiler/xlf/FSStrings.fr.xlf | 2 +- src/Compiler/xlf/FSStrings.it.xlf | 2 +- src/Compiler/xlf/FSStrings.ko.xlf | 2 +- src/Compiler/xlf/FSStrings.pl.xlf | 2 +- src/Compiler/xlf/FSStrings.tr.xlf | 2 +- src/Compiler/xlf/FSStrings.zh-Hans.xlf | 2 +- 18 files changed, 270 insertions(+), 270 deletions(-) diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index 8a1853a380f..cbbbdf04763 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -189,12 +189,12 @@ static abstract interface members - static abstract interface members + statičtí abstraktní členové rozhraní support for consuming init properties - support for consuming init properties + podpora využívání vlastností init @@ -204,7 +204,7 @@ Allow lowercase DU when RequireQualifiedAccess attribute - Allow lowercase DU when RequireQualifiedAccess attribute + Povolit duplikát malými písmeny při atributu RequireQualifiedAccess @@ -269,7 +269,7 @@ support for required properties - support for required properties + podpora požadovaných vlastností @@ -279,7 +279,7 @@ self type constraints - self type constraints + omezení vlastního typu @@ -329,7 +329,7 @@ The '%A' format specifier may not be used in an assembly being compiled with option '--reflectionfree'. This construct implicitly uses reflection. - The '%A' format specifier may not be used in an assembly being compiled with option '--reflectionfree'. This construct implicitly uses reflection. + Specifikátor formátu %A nelze použít v sestavení kompilovaném s možností --reflectionfree. Tento konstruktor implicitně používá reflexi. @@ -374,7 +374,7 @@ Used to check if an object is of the given type in a pattern or binding. - Used to check if an object is of the given type in a pattern or binding. + Slouží ke kontrole, zda je objekt daného typu ve vzoru nebo vazbě. @@ -474,12 +474,12 @@ Compress interface and optimization data files - Compress interface and optimization data files + Komprimovat datové soubory rozhraní a optimalizace Display the allowed values for language version. - Display the allowed values for language version. + Zobrazí povolené hodnoty pro jazykovou verzi. @@ -494,12 +494,12 @@ Specify included optimization information, the default is file. Important for distributed libraries. - Specify included optimization information, the default is file. Important for distributed libraries. + Zadejte zahrnuté informace o optimalizaci, výchozí hodnota je soubor. Důležité pro distribuované knihovny. The pdb output file name cannot match the build output filename use --pdb:filename.pdb - The pdb output file name cannot match the build output filename use --pdb:filename.pdb + Název výstupního souboru pdb se nemůže shodovat s výstupním názvem souboru sestavení pomocí --pdb:filename.pdb. @@ -514,17 +514,17 @@ Disable implicit generation of constructs using reflection - Disable implicit generation of constructs using reflection + Zakázat implicitní generování konstruktorů pomocí reflexe Specify language version such as 'latest' or 'preview'. - Specify language version such as 'latest' or 'preview'. + Upřesněte verzi jazyka, například „latest“ nebo „preview“. Include F# interface information, the default is file. Essential for distributing libraries. - Include F# interface information, the default is file. Essential for distributing libraries. + Zahrnout informace o rozhraní F#, výchozí je soubor. Klíčové pro distribuci knihoven. @@ -534,12 +534,12 @@ Invalid value '{0}' for --optimizationdata, valid value are: none, file, compress. - Invalid value '{0}' for --optimizationdata, valid value are: none, file, compress. + Neplatná hodnota '{0}' pro --optimizationdata, platná hodnota: none, file, compress. Invalid value '{0}' for --interfacedata, valid value are: none, file, compress. - Invalid value '{0}' for --interfacedata, valid value are: none, file, compress. + Neplatná hodnota „{0}“ pro --interfacedata, platná hodnota je: none, file, compress. @@ -594,12 +594,12 @@ Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) - Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) + Neúplný znakový literál (příklad: Q) nebo volání kvalifikovaného typu (příklad: T.Name) Incomplete operator expression (example a^b) or qualified type invocation (example: ^T.Name) - Incomplete operator expression (example a^b) or qualified type invocation (example: ^T.Name) + Neúplný výraz operátoru (například^b) nebo volání kvalifikovaného typu (příklad: ^T.Name) @@ -784,7 +784,7 @@ Init-only property '{0}' cannot be set outside the initialization code. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization - Init-only property '{0}' cannot be set outside the initialization code. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization + Vlastnost init-only „{0}“ nelze nastavit mimo inicializační kód. Zobrazit https://aka.ms/fsharp-assigning-values-to-properties-at-initialization @@ -814,7 +814,7 @@ Invalid constraint. Valid constraint forms include \"'T :> ISomeInterface\" for interface constraints and \"SomeConstrainingType<'T>\" for self-constraints. See https://aka.ms/fsharp-type-constraints. - Invalid constraint. Valid constraint forms include \"'T :> ISomeInterface\" for interface constraints and \"SomeConstrainingType<'T>\" for self-constraints. See https://aka.ms/fsharp-type-constraints. + Neplatné omezení. Platné formuláře omezení zahrnují "T :> ISomeInterface\" pro omezení rozhraní a \"SomeConstrainingType<'T>\" pro vlastní omezení. Viz https://aka.ms/fsharp-type-constraints. @@ -859,7 +859,7 @@ The following required properties have to be initalized:{0} - The following required properties have to be initalized:{0} + Je třeba inicializovat následující požadované vlastnosti:{0} @@ -944,7 +944,7 @@ Cannot call '{0}' - a setter for init-only property, please use object initialization instead. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization - Cannot call '{0}' - a setter for init-only property, please use object initialization instead. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization + Nelze volat „{0}“ - metodu setter pro vlastnost pouze init. Použijte místo toho inicializaci objektu. Viz https://aka.ms/fsharp-assigning-values-to-properties-at-initialization @@ -954,27 +954,27 @@ The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. - The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. + Vlastnost{0}vyvolaná tímto voláním má více typů podpory. Tato syntaxe volání není pro takové vlastnosti povolená. Pokyny najdete v https://aka.ms/fsharp-srtp. Invocation of a static constraint should use \"'T.Ident\" and not \"^T.Ident\", even for statically resolved type parameters. - Invocation of a static constraint should use \"'T.Ident\" and not \"^T.Ident\", even for statically resolved type parameters. + Volání statického omezení by mělo používat "T.Ident\" a nikoli \"^T.Ident\", a to i pro staticky přeložené parametry typu. Trait '{0}' is not static - Trait '{0}' is not static + Vlastnost „{0}“ není statická. Trait '{0}' is static - Trait '{0}' is static + Vlastnost „{0}“ je statická. A trait may not specify optional, in, out, ParamArray, CallerInfo or Quote arguments - A trait may not specify optional, in, out, ParamArray, CallerInfo or Quote arguments + Vlastnost nesmí určovat volitelné argumenty, in, out, ParamArray, CallerInfo nebo Quote. @@ -984,12 +984,12 @@ '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. - '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. + '{0}' se obvykle používá jako omezení typu v obecném kódu, například \"T when ISomeInterface<'T>\" nebo \"let f (x: #ISomeInterface<_>)\". Pokyny najdete v https://aka.ms/fsharp-iwsams. Toto upozornění můžete zakázat pomocí #nowarn \"3536\" nebo '--nowarn:3536'. Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. - Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. + Deklarování \"interfaces with static abstract methods\" (rozhraní se statickými abstraktními metodami) je pokročilá funkce. Pokyny najdete v https://aka.ms/fsharp-iwsams. Toto upozornění můžete zakázat pomocí #nowarn \"3535\" nebo '--nowarn:3535'. diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index e96c8e1d3b2..373b6a438d9 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -189,12 +189,12 @@ static abstract interface members - static abstract interface members + statische abstrakte Schnittstellenmitglieder support for consuming init properties - support for consuming init properties + Unterstützung für die Nutzung von Initialisierungseigenschaften @@ -204,7 +204,7 @@ Allow lowercase DU when RequireQualifiedAccess attribute - Allow lowercase DU when RequireQualifiedAccess attribute + DU in Kleinbuchstaben zulassen, wenn requireQualifiedAccess-Attribut @@ -269,7 +269,7 @@ support for required properties - support for required properties + Unterstützung für erforderliche Eigenschaften @@ -279,7 +279,7 @@ self type constraints - self type constraints + Selbsttypeinschränkungen @@ -329,7 +329,7 @@ The '%A' format specifier may not be used in an assembly being compiled with option '--reflectionfree'. This construct implicitly uses reflection. - The '%A' format specifier may not be used in an assembly being compiled with option '--reflectionfree'. This construct implicitly uses reflection. + Der Formatbezeichner „%A“ darf nicht in einer Assembly verwendet werden, die mit der Option „--reflectionfree“ kompiliert wird. Dieses Konstrukt verwendet implizit die Reflektion. @@ -374,7 +374,7 @@ Used to check if an object is of the given type in a pattern or binding. - Used to check if an object is of the given type in a pattern or binding. + Wird verwendet, um zu überprüfen, ob ein Objekt in einem Muster oder einer Bindung vom angegebenen Typ ist. @@ -474,12 +474,12 @@ Compress interface and optimization data files - Compress interface and optimization data files + Komprimieren von Schnittstellen- und Optimierungsdatendateien Display the allowed values for language version. - Display the allowed values for language version. + Anzeigen der zulässigen Werte für die Sprachversion. @@ -494,12 +494,12 @@ Specify included optimization information, the default is file. Important for distributed libraries. - Specify included optimization information, the default is file. Important for distributed libraries. + Geben Sie die enthaltenen Optimierungsinformationen an, der Standardwert ist „file“. Wichtig für verteilte Bibliotheken. The pdb output file name cannot match the build output filename use --pdb:filename.pdb - The pdb output file name cannot match the build output filename use --pdb:filename.pdb + Der Name der PDB-Ausgabedatei kann nicht mit dem Ausgabedateinamen für den Build übereinstimmen, verwenden Sie --pdb:filename.pdb @@ -514,17 +514,17 @@ Disable implicit generation of constructs using reflection - Disable implicit generation of constructs using reflection + Deaktivieren der impliziten Generierung von Konstrukten mithilfe von Reflektion Specify language version such as 'latest' or 'preview'. - Specify language version such as 'latest' or 'preview'. + Geben Sie eine Sprachversion wie „latest“ oder „preview“ an. Include F# interface information, the default is file. Essential for distributing libraries. - Include F# interface information, the default is file. Essential for distributing libraries. + Schließen Sie F#-Schnittstelleninformationen ein, der Standardwert ist „file“. Wesentlich für die Verteilung von Bibliotheken. @@ -534,12 +534,12 @@ Invalid value '{0}' for --optimizationdata, valid value are: none, file, compress. - Invalid value '{0}' for --optimizationdata, valid value are: none, file, compress. + Ungültiger Wert „{0}“ für --optimizationdata. Gültige Werte sind: none, file, compress. Invalid value '{0}' for --interfacedata, valid value are: none, file, compress. - Invalid value '{0}' for --interfacedata, valid value are: none, file, compress. + Ungültiger Wert „{0}“ für --interfacedata. Gültige Werte sind: none, file, compress. @@ -594,12 +594,12 @@ Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) - Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) + Unvollständiges Zeichenliteral (Beispiel: „Q“) oder qualifizierter Typaufruf (Beispiel: „T.Name“) Incomplete operator expression (example a^b) or qualified type invocation (example: ^T.Name) - Incomplete operator expression (example a^b) or qualified type invocation (example: ^T.Name) + Unvollständiger Operatorausdruck (Beispiel: a^b) oder qualifizierter Typaufruf (Beispiel: ^T.Name) @@ -784,7 +784,7 @@ Init-only property '{0}' cannot be set outside the initialization code. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization - Init-only property '{0}' cannot be set outside the initialization code. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization + Die Eigenschaft „{0}“ nur für die Initialisierung kann nicht außerhalb des Initialisierungscodes festgelegt werden. Siehe https://aka.ms/fsharp-assigning-values-to-properties-at-initialization @@ -814,7 +814,7 @@ Invalid constraint. Valid constraint forms include \"'T :> ISomeInterface\" for interface constraints and \"SomeConstrainingType<'T>\" for self-constraints. See https://aka.ms/fsharp-type-constraints. - Invalid constraint. Valid constraint forms include \"'T :> ISomeInterface\" for interface constraints and \"SomeConstrainingType<'T>\" for self-constraints. See https://aka.ms/fsharp-type-constraints. + Ungültige Einschränkung. Gültige Einschränkungsformen sind \"'T :> ISomeInterface\" für Schnittstelleneinschränkungen und\"SomeConstrainingType<'T>\" für Selbsteinschränkungen. Siehe https://aka.ms/fsharp-type-constraints. @@ -859,7 +859,7 @@ The following required properties have to be initalized:{0} - The following required properties have to be initalized:{0} + Die folgenden erforderlichen Eigenschaften müssen initialisiert werden:{0} @@ -944,7 +944,7 @@ Cannot call '{0}' - a setter for init-only property, please use object initialization instead. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization - Cannot call '{0}' - a setter for init-only property, please use object initialization instead. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization + „{0}“ kann nicht aufgerufen werden – ein Setter für die Eigenschaft nur für die Initialisierung. Bitte verwenden Sie stattdessen die Objektinitialisierung. Siehe https://aka.ms/fsharp-assigning-values-to-properties-at-initialization @@ -954,27 +954,27 @@ The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. - The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. + Das Merkmal „{0}“, das von diesem Aufruf aufgerufen wird, weist mehrere Unterstützungstypen auf. Diese Aufrufsyntax ist für solche Merkmale nicht zulässig. Anleitungen finden Sie unter https://aka.ms/fsharp-srtp. Invocation of a static constraint should use \"'T.Ident\" and not \"^T.Ident\", even for statically resolved type parameters. - Invocation of a static constraint should use \"'T.Ident\" and not \"^T.Ident\", even for statically resolved type parameters. + Beim Aufruf einer statischen Einschränkung sollte \"'T.Ident\" verwendet werden und nicht \"^T.Ident\", selbst für statisch aufgelöste Typparameter. Trait '{0}' is not static - Trait '{0}' is not static + Das Merkmal „{0}“ ist nicht statisch. Trait '{0}' is static - Trait '{0}' is static + Das Merkmal „{0}“ ist statisch. A trait may not specify optional, in, out, ParamArray, CallerInfo or Quote arguments - A trait may not specify optional, in, out, ParamArray, CallerInfo or Quote arguments + Ein Merkmal darf keine Argumente für „optional“, „in“, „out“, „ParamArray“", „CallerInfo“ oder „Quote“ angeben. @@ -984,12 +984,12 @@ '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. - '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. + „{0}“ wird normalerweise als Typeinschränkung im generischen Code verwendet, z. B. \"'T when ISomeInterface<'T>\" oder \"let f (x: #ISomeInterface<_>)\". Anleitungen finden Sie unter https://aka.ms/fsharp-iwsams. Sie können diese Warnung deaktivieren, indem Sie „#nowarn \"3536\"“ or „--nowarn:3536“ verwenden. Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. - Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. + Das Deklarieren von \"Schnittstellen mit statischen abstrakten Methoden\" ist ein erweitertes Feature. Anleitungen finden Sie unter https://aka.ms/fsharp-iwsams. Sie können diese Warnung deaktivieren, indem Sie „#nowarn \"3535\"“ or „--nowarn:3535“ verwenden. diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index 8c034062331..cd55eda37b9 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -189,12 +189,12 @@ static abstract interface members - static abstract interface members + miembros de interfaz abstracta estática support for consuming init properties - support for consuming init properties + compatibilidad con el consumo de propiedades init @@ -204,7 +204,7 @@ Allow lowercase DU when RequireQualifiedAccess attribute - Allow lowercase DU when RequireQualifiedAccess attribute + Permitir DU en minúsculas con el atributo RequireQualifiedAccess @@ -269,7 +269,7 @@ support for required properties - support for required properties + compatibilidad con las propiedades necesarias @@ -279,7 +279,7 @@ self type constraints - self type constraints + restricciones de tipo propio @@ -329,7 +329,7 @@ The '%A' format specifier may not be used in an assembly being compiled with option '--reflectionfree'. This construct implicitly uses reflection. - The '%A' format specifier may not be used in an assembly being compiled with option '--reflectionfree'. This construct implicitly uses reflection. + El especificador de formato '%A' no se puede usar en un ensamblado que se está compilando con la opción '--reflectionfree'. Esta construcción usa implícitamente la reflexión. @@ -374,7 +374,7 @@ Used to check if an object is of the given type in a pattern or binding. - Used to check if an object is of the given type in a pattern or binding. + Se usa para comprobar si un objeto es del tipo especificado en un patrón o enlace. @@ -474,12 +474,12 @@ Compress interface and optimization data files - Compress interface and optimization data files + Comprimir archivos de datos de interfaz y optimización Display the allowed values for language version. - Display the allowed values for language version. + Muestra los valores permitidos para la versión del lenguaje. @@ -494,12 +494,12 @@ Specify included optimization information, the default is file. Important for distributed libraries. - Specify included optimization information, the default is file. Important for distributed libraries. + Especifique la información de optimización incluida, el valor predeterminado es el archivo. Importante para las bibliotecas distribuidas. The pdb output file name cannot match the build output filename use --pdb:filename.pdb - The pdb output file name cannot match the build output filename use --pdb:filename.pdb + El nombre del archivo de salida pdb no puede coincidir con el nombre de archivo de salida de compilación. Use --pdb:filename.pdb @@ -514,17 +514,17 @@ Disable implicit generation of constructs using reflection - Disable implicit generation of constructs using reflection + Deshabilitar la generación implícita de construcciones mediante reflexión Specify language version such as 'latest' or 'preview'. - Specify language version such as 'latest' or 'preview'. + Especifique la versión de idioma, como "latest" o "preview". Include F# interface information, the default is file. Essential for distributing libraries. - Include F# interface information, the default is file. Essential for distributing libraries. + Incluir información de interfaz de F#, el valor predeterminado es file. Esencial para distribuir bibliotecas. @@ -534,12 +534,12 @@ Invalid value '{0}' for --optimizationdata, valid value are: none, file, compress. - Invalid value '{0}' for --optimizationdata, valid value are: none, file, compress. + Valor no válido '{0}' para --optimizationdata; los valores válidos son: none, file, compress. Invalid value '{0}' for --interfacedata, valid value are: none, file, compress. - Invalid value '{0}' for --interfacedata, valid value are: none, file, compress. + Valor no válido '{0}' para --interfacedata; los valores válidos son: none, file, compress. @@ -594,12 +594,12 @@ Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) - Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) + Literal de carácter incompleto (ejemplo: 'Q') o invocación de tipo completo (ejemplo: 'T.Name) Incomplete operator expression (example a^b) or qualified type invocation (example: ^T.Name) - Incomplete operator expression (example a^b) or qualified type invocation (example: ^T.Name) + Expresión de operador incompleta (ejemplo, a^b) o invocación de tipo calificada (ejemplo: ^T.Name) @@ -784,7 +784,7 @@ Init-only property '{0}' cannot be set outside the initialization code. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization - Init-only property '{0}' cannot be set outside the initialization code. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization + No se puede establecer la propiedad init-only '{0}' fuera del código de inicialización. Ver https://aka.ms/fsharp-assigning-values-to-properties-at-initialization @@ -814,7 +814,7 @@ Invalid constraint. Valid constraint forms include \"'T :> ISomeInterface\" for interface constraints and \"SomeConstrainingType<'T>\" for self-constraints. See https://aka.ms/fsharp-type-constraints. - Invalid constraint. Valid constraint forms include \"'T :> ISomeInterface\" for interface constraints and \"SomeConstrainingType<'T>\" for self-constraints. See https://aka.ms/fsharp-type-constraints. + Restricción no válida. Los formularios de restricción válidos incluyen \"'T :> ISomeInterface\" para restricciones de interfaz y \"SomeConstrainingType<'T>\" para restricciones propias. Ver https://aka.ms/fsharp-type-constraints. @@ -859,7 +859,7 @@ The following required properties have to be initalized:{0} - The following required properties have to be initalized:{0} + Se deben inicializar las siguientes propiedades necesarias:{0} @@ -944,7 +944,7 @@ Cannot call '{0}' - a setter for init-only property, please use object initialization instead. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization - Cannot call '{0}' - a setter for init-only property, please use object initialization instead. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization + No se puede llamar a '{0}': un establecedor para una propiedad de solo inicialización. Use la inicialización del objeto en su lugar. Ver https://aka.ms/fsharp-assigning-values-to-properties-at-initialization @@ -954,27 +954,27 @@ The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. - The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. + El rasgo '{0}' invocado por esta llamada tiene varios tipos de soporte. No se permite esta sintaxis de invocación para estos rasgos. Consulte https://aka.ms/fsharp-srtp para obtener instrucciones. Invocation of a static constraint should use \"'T.Ident\" and not \"^T.Ident\", even for statically resolved type parameters. - Invocation of a static constraint should use \"'T.Ident\" and not \"^T.Ident\", even for statically resolved type parameters. + La invocación de una restricción estática debe usar \"'T.Ident\" y no \"^T.Ident\", incluso para parámetros de tipo resueltos estáticamente. Trait '{0}' is not static - Trait '{0}' is not static + El rasgo '{0}' no es estático Trait '{0}' is static - Trait '{0}' is static + El rasgo '{0}' es estático A trait may not specify optional, in, out, ParamArray, CallerInfo or Quote arguments - A trait may not specify optional, in, out, ParamArray, CallerInfo or Quote arguments + Un rasgo no puede especificar argumentos opcionales, in, out, ParamArray, CallerInfo o Quote @@ -984,12 +984,12 @@ '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. - '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. + '{0}' se usa normalmente como restricción de tipo en código genérico; por ejemplo, \"'T when ISomeInterface<'T>\" o \"let f (x: #ISomeInterface<_>)\". Consulte https://aka.ms/fsharp-iwsams para obtener instrucciones. Puede deshabilitar esta advertencia con "#nowarn \"3536\"" o "--nowarn:3536". Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. - Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. + Declarar \"interfaces con métodos abstractos estáticos\" es una característica avanzada. Consulte https://aka.ms/fsharp-iwsams para obtener instrucciones. Puede deshabilitar esta advertencia con "#nowarn \"3535\"" o "--nowarn:3535". diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index ab6345e8e0c..5c081ec7c61 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -189,12 +189,12 @@ static abstract interface members - static abstract interface members + membres d’interface abstraite statiques support for consuming init properties - support for consuming init properties + prise en charge de la consommation des propriétés init @@ -204,7 +204,7 @@ Allow lowercase DU when RequireQualifiedAccess attribute - Allow lowercase DU when RequireQualifiedAccess attribute + Autoriser les DU en minuscules pour l'attribut RequireQualifiedAccess @@ -269,7 +269,7 @@ support for required properties - support for required properties + prise en charge des propriétés obligatoires @@ -279,7 +279,7 @@ self type constraints - self type constraints + contraintes d’auto-type @@ -329,7 +329,7 @@ The '%A' format specifier may not be used in an assembly being compiled with option '--reflectionfree'. This construct implicitly uses reflection. - The '%A' format specifier may not be used in an assembly being compiled with option '--reflectionfree'. This construct implicitly uses reflection. + Le spécificateur de format '%A' ne peut pas être utilisé dans un assembly compilé avec l’option '--reflectionfree'. Cette construction utilise implicitement la réflexion. @@ -374,7 +374,7 @@ Used to check if an object is of the given type in a pattern or binding. - Used to check if an object is of the given type in a pattern or binding. + Permet de vérifier si un objet est du type donné dans un modèle ou une liaison. @@ -474,12 +474,12 @@ Compress interface and optimization data files - Compress interface and optimization data files + Compresser les fichiers de données d’interface et d’optimisation Display the allowed values for language version. - Display the allowed values for language version. + Affichez les valeurs autorisées pour la version du langage. @@ -494,12 +494,12 @@ Specify included optimization information, the default is file. Important for distributed libraries. - Specify included optimization information, the default is file. Important for distributed libraries. + Spécifiez les informations d’optimisation incluses, la valeur par défaut est le fichier. Important pour les bibliothèques distribuées. The pdb output file name cannot match the build output filename use --pdb:filename.pdb - The pdb output file name cannot match the build output filename use --pdb:filename.pdb + Le nom du fichier de sortie pdb ne peut pas correspondre au nom de fichier de sortie de build utilisé --pdb:filename.pdb. @@ -514,17 +514,17 @@ Disable implicit generation of constructs using reflection - Disable implicit generation of constructs using reflection + Désactiver la génération implicite de constructions à l’aide de la réflexion Specify language version such as 'latest' or 'preview'. - Specify language version such as 'latest' or 'preview'. + Spécifiez une version de langage telle que 'latest' ou 'preview'. Include F# interface information, the default is file. Essential for distributing libraries. - Include F# interface information, the default is file. Essential for distributing libraries. + Incluez les informations de l’interface F#, la valeur par défaut est un fichier. Essentiel pour la distribution des bibliothèques. @@ -534,12 +534,12 @@ Invalid value '{0}' for --optimizationdata, valid value are: none, file, compress. - Invalid value '{0}' for --optimizationdata, valid value are: none, file, compress. + Valeur non valide '{0}' pour --optimizationdata. Les valeurs valides sont : none, file, compress. Invalid value '{0}' for --interfacedata, valid value are: none, file, compress. - Invalid value '{0}' for --interfacedata, valid value are: none, file, compress. + Valeur non valide '{0}' pour --interfacedata. Les valeurs valides sont : none, file, compress. @@ -594,12 +594,12 @@ Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) - Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) + Littéral de caractère incomplet (exemple : 'Q') ou appel de type qualifié (exemple : 'T.Name) Incomplete operator expression (example a^b) or qualified type invocation (example: ^T.Name) - Incomplete operator expression (example a^b) or qualified type invocation (example: ^T.Name) + Expression d’opérateur incomplète (exemple a^b) ou appel de type qualifié (exemple : ^T.Name) @@ -784,7 +784,7 @@ Init-only property '{0}' cannot be set outside the initialization code. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization - Init-only property '{0}' cannot be set outside the initialization code. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization + La propriété init-only '{0}' ne peut pas être définie en dehors du code d’initialisation. Voir https://aka.ms/fsharp-assigning-values-to-properties-at-initialization @@ -814,7 +814,7 @@ Invalid constraint. Valid constraint forms include \"'T :> ISomeInterface\" for interface constraints and \"SomeConstrainingType<'T>\" for self-constraints. See https://aka.ms/fsharp-type-constraints. - Invalid constraint. Valid constraint forms include \"'T :> ISomeInterface\" for interface constraints and \"SomeConstrainingType<'T>\" for self-constraints. See https://aka.ms/fsharp-type-constraints. + Contrainte non valide. Les formes de contrainte valides incluent \"'T :> ISomeInterface\" pour les contraintes d’interface et \"SomeConstrainingType<'T>\" pour les contraintes automatiques. Consultez https://aka.ms/fsharp-type-constraints. @@ -859,7 +859,7 @@ The following required properties have to be initalized:{0} - The following required properties have to be initalized:{0} + Les propriétés requises suivantes doivent être initialisées :{0} @@ -944,7 +944,7 @@ Cannot call '{0}' - a setter for init-only property, please use object initialization instead. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization - Cannot call '{0}' - a setter for init-only property, please use object initialization instead. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization + Nous n’avons pas pu appeler '{0}' - méthode setter pour la propriété init-only. Utilisez plutôt l’initialisation d’objet. Consultez https://aka.ms/fsharp-assigning-values-to-properties-at-initialization. @@ -954,27 +954,27 @@ The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. - The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. + La caractéristique '{0}' invoquée par cet appel a plusieurs types de prise en charge. Cette syntaxe d’appel n’est pas autorisée pour de telles caractéristiques. Consultez https://aka.ms/fsharp-srtp pour obtenir de l’aide. Invocation of a static constraint should use \"'T.Ident\" and not \"^T.Ident\", even for statically resolved type parameters. - Invocation of a static constraint should use \"'T.Ident\" and not \"^T.Ident\", even for statically resolved type parameters. + L’appel d’une contrainte statique doit utiliser \"'T.Ident\" et non \"^T.Ident\", même pour les paramètres de type résolus statiquement. Trait '{0}' is not static - Trait '{0}' is not static + Le '{0}' de caractéristique n’est pas statique. Trait '{0}' is static - Trait '{0}' is static + Le '{0}' de caractéristique est statique. A trait may not specify optional, in, out, ParamArray, CallerInfo or Quote arguments - A trait may not specify optional, in, out, ParamArray, CallerInfo or Quote arguments + Une caractéristique ne peut pas spécifier d’arguments facultatifs, in, out, ParamArray, CallerInfo ou Quote @@ -984,12 +984,12 @@ '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. - '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. + '{0}' est généralement utilisée comme contrainte de type dans le code générique, par exemple \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". Consultez https://aka.ms/fsharp-iwsams pour obtenir de l’aide. Vous pouvez désactiver cet avertissement à l’aide de '#nowarn \"3536\"' or '--nowarn:3536'. Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. - Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. + La déclaration de \"interfaces with static abstract methods\" est une fonctionnalité avancée. Consultez https://aka.ms/fsharp-iwsams pour obtenir de l’aide. Vous pouvez désactiver cet avertissement à l’aide de '#nowarn \"3535\"' or '--nowarn:3535'. diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 85a4a4cd333..8218e22b49a 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -189,12 +189,12 @@ static abstract interface members - static abstract interface members + membri dell'interfaccia astratta statica support for consuming init properties - support for consuming init properties + supporto per l'utilizzo delle proprietà init @@ -204,7 +204,7 @@ Allow lowercase DU when RequireQualifiedAccess attribute - Allow lowercase DU when RequireQualifiedAccess attribute + Consentire l’unione discriminata minuscola quando l'attributo RequireQualifiedAccess @@ -269,7 +269,7 @@ support for required properties - support for required properties + supporto per le proprietà obbligatorie @@ -279,7 +279,7 @@ self type constraints - self type constraints + vincoli di tipo automatico @@ -329,7 +329,7 @@ The '%A' format specifier may not be used in an assembly being compiled with option '--reflectionfree'. This construct implicitly uses reflection. - The '%A' format specifier may not be used in an assembly being compiled with option '--reflectionfree'. This construct implicitly uses reflection. + L'identificatore di formato '%A' non può essere utilizzato in un assembly compilato con l'opzione '--reflectionfree'. Questo costrutto usa in modo implicito reflection. @@ -374,7 +374,7 @@ Used to check if an object is of the given type in a pattern or binding. - Used to check if an object is of the given type in a pattern or binding. + Usato per controllare se un oggetto è del tipo specificato in un criterio o in un'associazione. @@ -474,12 +474,12 @@ Compress interface and optimization data files - Compress interface and optimization data files + File di dati di compressione dell’interfaccia e ottimizzazione Display the allowed values for language version. - Display the allowed values for language version. + Visualizzare i valori consentiti per la versione della lingua. @@ -494,12 +494,12 @@ Specify included optimization information, the default is file. Important for distributed libraries. - Specify included optimization information, the default is file. Important for distributed libraries. + Specificare le informazioni di ottimizzazione incluse. Il valore predefinito è file. Important per le librerie distribuite. The pdb output file name cannot match the build output filename use --pdb:filename.pdb - The pdb output file name cannot match the build output filename use --pdb:filename.pdb + Il nome del file di output pdb non può corrispondere all’uso del nome file di output della compilazione --pdb:filename.pdb @@ -514,17 +514,17 @@ Disable implicit generation of constructs using reflection - Disable implicit generation of constructs using reflection + Disabilitare la generazione implicita di costrutti usando reflection Specify language version such as 'latest' or 'preview'. - Specify language version such as 'latest' or 'preview'. + Specificare la versione della lingua, ad esempio 'latest' o 'preview'. Include F# interface information, the default is file. Essential for distributing libraries. - Include F# interface information, the default is file. Essential for distributing libraries. + Includere le informazioni sull'interfaccia F#. Il valore predefinito è file. Essential per la distribuzione di librerie. @@ -534,12 +534,12 @@ Invalid value '{0}' for --optimizationdata, valid value are: none, file, compress. - Invalid value '{0}' for --optimizationdata, valid value are: none, file, compress. + Valore non valido '{0}' per --optimizationdata. Valori validi sono: none, file, compress. Invalid value '{0}' for --interfacedata, valid value are: none, file, compress. - Invalid value '{0}' for --interfacedata, valid value are: none, file, compress. + Valore non valido '{0}' per --interfacedata. Valori validi sono: none, file, compress. @@ -594,12 +594,12 @@ Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) - Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) + Valore letterale carattere incompleto (ad esempio: 'Q') o chiamata di tipo qualificato (ad esempio: 'T.Name) Incomplete operator expression (example a^b) or qualified type invocation (example: ^T.Name) - Incomplete operator expression (example a^b) or qualified type invocation (example: ^T.Name) + Espressione operatore incompleta (ad esempio a^b) o chiamata di tipo qualificato (ad esempio: ^T.Name) @@ -784,7 +784,7 @@ Init-only property '{0}' cannot be set outside the initialization code. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization - Init-only property '{0}' cannot be set outside the initialization code. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization + La proprietà init-only '{0}' non può essere impostata al di fuori del codice di inizializzazione. Vedere https://aka.ms/fsharp-assigning-values-to-properties-at-initialization @@ -814,7 +814,7 @@ Invalid constraint. Valid constraint forms include \"'T :> ISomeInterface\" for interface constraints and \"SomeConstrainingType<'T>\" for self-constraints. See https://aka.ms/fsharp-type-constraints. - Invalid constraint. Valid constraint forms include \"'T :> ISomeInterface\" for interface constraints and \"SomeConstrainingType<'T>\" for self-constraints. See https://aka.ms/fsharp-type-constraints. + Vincolo non valido. Forme di vincoli validi includono \"'T :> ISomeInterface\" per i vincoli di interfaccia e \"SomeConstrainingType<'T>\" per i vincoli automatici. Vedere https://aka.ms/fsharp-type-constraints. @@ -859,7 +859,7 @@ The following required properties have to be initalized:{0} - The following required properties have to be initalized:{0} + È necessario inizializzare le proprietà obbligatorie seguenti:{0} @@ -944,7 +944,7 @@ Cannot call '{0}' - a setter for init-only property, please use object initialization instead. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization - Cannot call '{0}' - a setter for init-only property, please use object initialization instead. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization + Non è possibile chiamare '{0}', un setter per la proprietà init-only. Usare invece l'inizializzazione dell'oggetto. Vedere https://aka.ms/fsharp-assigning-values-to-properties-at-initialization @@ -954,27 +954,27 @@ The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. - The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. + Il tratto '{0}' chiamato da questa chiamata ha più tipi di supporto. Questa sintassi di chiamata non è consentita per tali tratti. Per indicazioni, vedere https://aka.ms/fsharp-srtp. Invocation of a static constraint should use \"'T.Ident\" and not \"^T.Ident\", even for statically resolved type parameters. - Invocation of a static constraint should use \"'T.Ident\" and not \"^T.Ident\", even for statically resolved type parameters. + La chiamata di un vincolo statico deve usare \"'T.Ident\" e non \"^T.Ident\", anche per i parametri di tipo risolti in modo statico. Trait '{0}' is not static - Trait '{0}' is not static + Il tratto '{0}' non è statico Trait '{0}' is static - Trait '{0}' is static + Il tratto '{0}' è statico A trait may not specify optional, in, out, ParamArray, CallerInfo or Quote arguments - A trait may not specify optional, in, out, ParamArray, CallerInfo or Quote arguments + Un tratto non può specificare argomenti optional, in, out, ParamArray, CallerInfo o Quote @@ -984,12 +984,12 @@ '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. - '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. + '{0}' viene in genere usato come vincolo di tipo nel codice generico, ad esempio \"'T when ISomeInterface<'T>\" o \"let f (x: #ISomeInterface<_>)\". Per indicazioni, vedere https://aka.ms/fsharp-iwsams. È possibile disabilitare questo avviso usando '#nowarn \"3536\"' o '--nowarn:3536'. Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. - Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. + La dichiarazione di \"interfaces with static abstract methods\" è una funzionalità avanzata. Per indicazioni, vedere https://aka.ms/fsharp-iwsams. È possibile disabilitare questo avviso usando '#nowarn \"3535\"' o '--nowarn:3535'. diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 1a4cb6964d8..56617fa2a21 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -189,12 +189,12 @@ static abstract interface members - static abstract interface members + 고정적인 추상 인터페이스 멤버 support for consuming init properties - support for consuming init properties + init 속성 사용 지원 @@ -204,7 +204,7 @@ Allow lowercase DU when RequireQualifiedAccess attribute - Allow lowercase DU when RequireQualifiedAccess attribute + RequireQualifiedAccess 특성이 있는 경우 소문자 DU 허용 @@ -269,7 +269,7 @@ support for required properties - support for required properties + 필수 속성 지원 @@ -279,7 +279,7 @@ self type constraints - self type constraints + 자체 형식 제약 조건 @@ -329,7 +329,7 @@ The '%A' format specifier may not be used in an assembly being compiled with option '--reflectionfree'. This construct implicitly uses reflection. - The '%A' format specifier may not be used in an assembly being compiled with option '--reflectionfree'. This construct implicitly uses reflection. + '%A' 형식 지정자는 '--reflectionfree' 옵션으로 컴파일되는 어셈블리에서 사용할 수 없습니다. 이 구문은 암시적으로 리플렉션을 사용합니다. @@ -374,7 +374,7 @@ Used to check if an object is of the given type in a pattern or binding. - Used to check if an object is of the given type in a pattern or binding. + 개체가 패턴 또는 바인딩에서 지정된 형식인지 확인하는 데 사용됩니다. @@ -474,12 +474,12 @@ Compress interface and optimization data files - Compress interface and optimization data files + 인터페이스 및 최적화 데이터 파일 압축 Display the allowed values for language version. - Display the allowed values for language version. + 언어 버전에 허용되는 값을 표시합니다. @@ -494,12 +494,12 @@ Specify included optimization information, the default is file. Important for distributed libraries. - Specify included optimization information, the default is file. Important for distributed libraries. + 포함된 최적화 정보를 지정합니다. 기본값은 파일입니다. 분산 라이브러리에 중요합니다. The pdb output file name cannot match the build output filename use --pdb:filename.pdb - The pdb output file name cannot match the build output filename use --pdb:filename.pdb + pdb 출력 파일 이름은 빌드 출력 파일 이름 사용 --pdb:filename.pdb와 일치할 수 없습니다. @@ -514,17 +514,17 @@ Disable implicit generation of constructs using reflection - Disable implicit generation of constructs using reflection + 리플렉션을 사용하여 구문의 암시적 생성 사용 안 함 Specify language version such as 'latest' or 'preview'. - Specify language version such as 'latest' or 'preview'. + 'latest' 또는 'preview'와 같이 언어 버전을 지정합니다. Include F# interface information, the default is file. Essential for distributing libraries. - Include F# interface information, the default is file. Essential for distributing libraries. + F# 인터페이스 정보를 포함합니다. 기본값은 파일입니다. 라이브러리를 배포하는 데 필수적입니다. @@ -534,12 +534,12 @@ Invalid value '{0}' for --optimizationdata, valid value are: none, file, compress. - Invalid value '{0}' for --optimizationdata, valid value are: none, file, compress. + --optimizationdata에 대한 '{0}' 값이 잘못되었습니다. 올바른 값은 none, file, compress입니다. Invalid value '{0}' for --interfacedata, valid value are: none, file, compress. - Invalid value '{0}' for --interfacedata, valid value are: none, file, compress. + --interfacedata에 대한 '{0}' 값이 잘못되었습니다. 올바른 값은 none, file, compress입니다. @@ -594,12 +594,12 @@ Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) - Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) + 불완전한 문자 리터럴(예: 'Q') 또는 정규화된 형식 호출(예: 'T.Name) Incomplete operator expression (example a^b) or qualified type invocation (example: ^T.Name) - Incomplete operator expression (example a^b) or qualified type invocation (example: ^T.Name) + 불완전한 연산자 식(예: a^b) 또는 정규화된 형식 호출(예: ^T.Name) @@ -784,7 +784,7 @@ Init-only property '{0}' cannot be set outside the initialization code. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization - Init-only property '{0}' cannot be set outside the initialization code. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization + 초기화 코드 외부에서는 '{0}' 초기화 전용 속성을 설정할 수 없습니다. https://aka.ms/fsharp-assigning-values-to-properties-at-initialization을 참조하세요. @@ -814,7 +814,7 @@ Invalid constraint. Valid constraint forms include \"'T :> ISomeInterface\" for interface constraints and \"SomeConstrainingType<'T>\" for self-constraints. See https://aka.ms/fsharp-type-constraints. - Invalid constraint. Valid constraint forms include \"'T :> ISomeInterface\" for interface constraints and \"SomeConstrainingType<'T>\" for self-constraints. See https://aka.ms/fsharp-type-constraints. + 제약 조건이 잘못되었습니다. 유효한 제약 조건 양식은 인터페이스 제약 조건의 경우 \"'T :> ISomeInterface\", 자체 제약 조건의 경우 \"SomeConstrainingType<'T>\" 등입니다. https://aka.ms/fsharp-type-constraints를 참조하세요. @@ -859,7 +859,7 @@ The following required properties have to be initalized:{0} - The following required properties have to be initalized:{0} + 다음 필수 속성을 초기화해야 합니다. {0} @@ -944,7 +944,7 @@ Cannot call '{0}' - a setter for init-only property, please use object initialization instead. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization - Cannot call '{0}' - a setter for init-only property, please use object initialization instead. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization + init 전용 속성의 setter인 '{0}'을(를) 호출할 수 없습니다. 개체 초기화를 대신 사용하세요. https://aka.ms/fsharp-assigning-values-to-properties-at-initialization를 참조하세요. @@ -954,27 +954,27 @@ The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. - The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. + 이 호출에서 호출한 '{0}' 특성에는 여러 지원 유형이 있습니다. 이러한 특성에는 이 호출 구문을 사용할 수 없습니다. 지침은 https://aka.ms/fsharp-srtp를 참조하세요. Invocation of a static constraint should use \"'T.Ident\" and not \"^T.Ident\", even for statically resolved type parameters. - Invocation of a static constraint should use \"'T.Ident\" and not \"^T.Ident\", even for statically resolved type parameters. + 고정적인 제약 조건 호출은 정적으로 확인된 형식 매개 변수의 경우에도 \"^T.Ident\"가 아니라 \"'T.Ident\"를 사용해야 합니다. Trait '{0}' is not static - Trait '{0}' is not static + '{0}' 특성은 고정적이지 않습니다. Trait '{0}' is static - Trait '{0}' is static + '{0}' 특성은 고정적입니다. A trait may not specify optional, in, out, ParamArray, CallerInfo or Quote arguments - A trait may not specify optional, in, out, ParamArray, CallerInfo or Quote arguments + 특성은 optional, in, out, ParamArray, CallerInfo, Quote 인수를 지정할 수 없습니다. @@ -984,12 +984,12 @@ '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. - '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. + '{0}'은(는) 일반적으로 제네릭 코드에서 형식 제약 조건으로 사용됩니다(예: \"'T when ISomeInterface<'T>\" 또는 \"let f (x: #ISomeInterface<_>)\"). 지침은 https://aka.ms/fsharp-iwsams를 참조하세요. '#nowarn \"3536\"' 또는 '--nowarn:3536'을 사용하여 이 경고를 비활성화할 수 있습니다. Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. - Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. + \"interfaces with static abstract methods\"를 선언하는 것은 고급 기능입니다. 지침은 https://aka.ms/fsharp-iwsams를 참조하세요. '#nowarn \"3535\"' 또는 '--nowarn:3535'를 사용하여 이 경고를 비활성화할 수 있습니다. diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index 1cc8dfb88f1..d8364453c4b 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -189,12 +189,12 @@ static abstract interface members - static abstract interface members + statyczne abstrakcyjne elementy członkowskie interfejsu support for consuming init properties - support for consuming init properties + obsługa używania właściwości init @@ -204,7 +204,7 @@ Allow lowercase DU when RequireQualifiedAccess attribute - Allow lowercase DU when RequireQualifiedAccess attribute + Zezwalaj na małą literę DU, gdy występuje RequireQualifiedAccess @@ -269,7 +269,7 @@ support for required properties - support for required properties + obsługa wymaganych właściwości @@ -279,7 +279,7 @@ self type constraints - self type constraints + ograniczenia typu własnego @@ -329,7 +329,7 @@ The '%A' format specifier may not be used in an assembly being compiled with option '--reflectionfree'. This construct implicitly uses reflection. - The '%A' format specifier may not be used in an assembly being compiled with option '--reflectionfree'. This construct implicitly uses reflection. + Specyfikator formatu „%A” nie może być używany w zestawie kompilowanym z opcją „--reflectionfree”. Ta konstrukcja niejawnie używa odbicia. @@ -374,7 +374,7 @@ Used to check if an object is of the given type in a pattern or binding. - Used to check if an object is of the given type in a pattern or binding. + Służy do sprawdzania, czy obiekt jest danego typu we wzorcu lub powiązaniu. @@ -474,12 +474,12 @@ Compress interface and optimization data files - Compress interface and optimization data files + Kompresuj pliki danych interfejsu i optymalizacji Display the allowed values for language version. - Display the allowed values for language version. + Wyświetl dozwolone wartości dla wersji językowej. @@ -494,12 +494,12 @@ Specify included optimization information, the default is file. Important for distributed libraries. - Specify included optimization information, the default is file. Important for distributed libraries. + Określ dołączone informacje o optymalizacji. Wartość domyślna to plik. Ważne dla bibliotek rozproszonych. The pdb output file name cannot match the build output filename use --pdb:filename.pdb - The pdb output file name cannot match the build output filename use --pdb:filename.pdb + Nazwa pliku wyjściowego pdb nie może być zgodna z nazwą pliku wyjściowego kompilacji, użyj parametru --pdb:filename.pdb @@ -514,17 +514,17 @@ Disable implicit generation of constructs using reflection - Disable implicit generation of constructs using reflection + Wyłącz niejawne generowanie konstrukcji przy użyciu odbicia Specify language version such as 'latest' or 'preview'. - Specify language version such as 'latest' or 'preview'. + Określ wersję językową, taką jak „najnowsza” lub „wersja zapoznawcza”. Include F# interface information, the default is file. Essential for distributing libraries. - Include F# interface information, the default is file. Essential for distributing libraries. + Uwzględnij informacje o interfejsie języka F#. Wartość domyślna to plik. Niezbędne do rozpowszechniania bibliotek. @@ -534,12 +534,12 @@ Invalid value '{0}' for --optimizationdata, valid value are: none, file, compress. - Invalid value '{0}' for --optimizationdata, valid value are: none, file, compress. + Nieprawidłowa wartość „{0}” dla parametru --optimizationdata, prawidłowa wartość to: none, file, compress. Invalid value '{0}' for --interfacedata, valid value are: none, file, compress. - Invalid value '{0}' for --interfacedata, valid value are: none, file, compress. + Nieprawidłowa wartość „{0}” dla parametru --interfacedata, prawidłowa wartość to: none, file, compress. @@ -594,12 +594,12 @@ Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) - Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) + Niekompletny literał znaku (przykład: „Q”) lub wywołanie typu kwalifikowanego (przykład: „T.Name”) Incomplete operator expression (example a^b) or qualified type invocation (example: ^T.Name) - Incomplete operator expression (example a^b) or qualified type invocation (example: ^T.Name) + Niekompletne wyrażenie operatora (na przykład a^b) lub wywołanie typu kwalifikowanego (przykład: ^T.Name) @@ -784,7 +784,7 @@ Init-only property '{0}' cannot be set outside the initialization code. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization - Init-only property '{0}' cannot be set outside the initialization code. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization + Właściwość init-only „{0}” nie może być ustawiona poza kodem inicjowania. Zobacz https://aka.ms/fsharp-assigning-values-to-properties-at-initialization @@ -814,7 +814,7 @@ Invalid constraint. Valid constraint forms include \"'T :> ISomeInterface\" for interface constraints and \"SomeConstrainingType<'T>\" for self-constraints. See https://aka.ms/fsharp-type-constraints. - Invalid constraint. Valid constraint forms include \"'T :> ISomeInterface\" for interface constraints and \"SomeConstrainingType<'T>\" for self-constraints. See https://aka.ms/fsharp-type-constraints. + Nieprawidłowe ograniczenie. Prawidłowe formularze ograniczeń obejmują \"'T :> ISomeInterface\" for interface constraints and \"SomeConstrainingType<'T>\" dla ograniczeń własnych. Zobacz https://aka.ms/fsharp-type-constraints. @@ -859,7 +859,7 @@ The following required properties have to be initalized:{0} - The following required properties have to be initalized:{0} + Następujące wymagane właściwości muszą zostać zainicjowane:{0} @@ -944,7 +944,7 @@ Cannot call '{0}' - a setter for init-only property, please use object initialization instead. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization - Cannot call '{0}' - a setter for init-only property, please use object initialization instead. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization + Nie można wywołać „{0}” — metody ustawiającej dla właściwości tylko do inicjowania. Zamiast tego użyj inicjowania obiektu. Zobacz https://aka.ms/fsharp-assigning-values-to-properties-at-initialization @@ -954,27 +954,27 @@ The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. - The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. + Cecha „{0}” wywołana przez to wywołanie ma wiele typów obsługi. Ta składnia wywołania nie jest dozwolona dla takich cech. Aby uzyskać wskazówki, zobacz https://aka.ms/fsharp-srtp. Invocation of a static constraint should use \"'T.Ident\" and not \"^T.Ident\", even for statically resolved type parameters. - Invocation of a static constraint should use \"'T.Ident\" and not \"^T.Ident\", even for statically resolved type parameters. + Wywołanie ograniczenia statycznego powinno używać elementu \"' T.Ident\" a nie \"^T.Ident\", nawet w przypadku statycznie rozpoznawanych parametrów typu. Trait '{0}' is not static - Trait '{0}' is not static + Cecha „{0}” nie jest statyczna Trait '{0}' is static - Trait '{0}' is static + Cecha „{0}” jest statyczna A trait may not specify optional, in, out, ParamArray, CallerInfo or Quote arguments - A trait may not specify optional, in, out, ParamArray, CallerInfo or Quote arguments + Cecha nie może określać opcjonalnych argumentów in, out, ParamArray, CallerInfo lub Quote @@ -984,12 +984,12 @@ '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. - '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. + Element „{0}” jest zwykle używany jako ograniczenie typu w kodzie ogólnym, np. \"" T, gdy ISomeInterface<' T>\" lub \"let f (x: #ISomeInterface<_>)\". Aby uzyskać wskazówki, zobacz https://aka.ms/fsharp-iwsams. To ostrzeżenie można wyłączyć, używając polecenia „nowarn \"3536\"" lub "--nowarn:3536”. Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. - Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. + Deklarowanie \"interfejsów ze statycznymi metodami abstrakcyjnymi\" jest funkcją zaawansowaną. Aby uzyskać wskazówki, zobacz https://aka.ms/fsharp-iwsams. To ostrzeżenie można wyłączyć przy użyciu polecenia „#nowarn \"3535\"" lub "--nowarn:3535”. diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index 7ee5a8cb3bc..89411181e8b 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -189,12 +189,12 @@ static abstract interface members - static abstract interface members + statik soyut arabirim üyeleri support for consuming init properties - support for consuming init properties + başlatma özelliklerini kullanma desteği @@ -204,7 +204,7 @@ Allow lowercase DU when RequireQualifiedAccess attribute - Allow lowercase DU when RequireQualifiedAccess attribute + RequireQualifiedAccess özniteliğinde küçük harf DU'ya izin ver @@ -269,7 +269,7 @@ support for required properties - support for required properties + gerekli özellikler için destek @@ -279,7 +279,7 @@ self type constraints - self type constraints + kendi kendine tür kısıtlamaları @@ -329,7 +329,7 @@ The '%A' format specifier may not be used in an assembly being compiled with option '--reflectionfree'. This construct implicitly uses reflection. - The '%A' format specifier may not be used in an assembly being compiled with option '--reflectionfree'. This construct implicitly uses reflection. + '%A' biçim belirticisi, '--reflectionfree' seçeneğiyle derlenen bir derlemede kullanılamaz. Bu yapı örtük olarak yansımayı kullanır. @@ -374,7 +374,7 @@ Used to check if an object is of the given type in a pattern or binding. - Used to check if an object is of the given type in a pattern or binding. + Bir nesnenin desende veya bağlamada verilen türde olup olmadığını kontrol etmek için kullanılır. @@ -474,12 +474,12 @@ Compress interface and optimization data files - Compress interface and optimization data files + Arabirim ve iyileştirme veri dosyalarını sıkıştır Display the allowed values for language version. - Display the allowed values for language version. + Dil sürümü için izin verilen değerleri görüntüleyin. @@ -494,12 +494,12 @@ Specify included optimization information, the default is file. Important for distributed libraries. - Specify included optimization information, the default is file. Important for distributed libraries. + Dahil edilen iyileştirme bilgilerini belirtin; varsayılan değer dosyadır. Dağıtılmış kitaplıklar için önemlidir. The pdb output file name cannot match the build output filename use --pdb:filename.pdb - The pdb output file name cannot match the build output filename use --pdb:filename.pdb + pdb çıkış dosyası adı, derleme çıkış dosya adı kullanımı --pdb:filename.pdb ile eşleşmiyor @@ -514,17 +514,17 @@ Disable implicit generation of constructs using reflection - Disable implicit generation of constructs using reflection + Yansıma kullanarak yapıların örtük oluşturulmasını devre dışı bırak Specify language version such as 'latest' or 'preview'. - Specify language version such as 'latest' or 'preview'. + 'latest' veya 'preview' gibi dil sürümünü belirtin. Include F# interface information, the default is file. Essential for distributing libraries. - Include F# interface information, the default is file. Essential for distributing libraries. + F# arabirim bilgilerini dahil edin; varsayılan değer dosyadır. Kitaplıkları dağıtmak için gereklidir. @@ -534,12 +534,12 @@ Invalid value '{0}' for --optimizationdata, valid value are: none, file, compress. - Invalid value '{0}' for --optimizationdata, valid value are: none, file, compress. + --optimizationdata için geçersiz '{0}' değeri, geçerli değerler: none, file, compress. Invalid value '{0}' for --interfacedata, valid value are: none, file, compress. - Invalid value '{0}' for --interfacedata, valid value are: none, file, compress. + --interfacedata için geçersiz '{0}' değeri, geçerli değerler: none, file, compress. @@ -594,12 +594,12 @@ Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) - Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) + Eksik karakter değişmez değeri (örnek: 'Q') veya tam tür çağrısı (örnek: 'T.Name) Incomplete operator expression (example a^b) or qualified type invocation (example: ^T.Name) - Incomplete operator expression (example a^b) or qualified type invocation (example: ^T.Name) + Eksik işleç ifadesi (örnek a^b) veya tam tür çağrısı (örnek: ^T.Name) @@ -784,7 +784,7 @@ Init-only property '{0}' cannot be set outside the initialization code. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization - Init-only property '{0}' cannot be set outside the initialization code. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization + '{0}' yalnızca başlatma özelliği başlatma kodunun dışında ayarlanamaz. Bkz. https://aka.ms/fsharp-assigning-values-to-properties-at-initialization @@ -814,7 +814,7 @@ Invalid constraint. Valid constraint forms include \"'T :> ISomeInterface\" for interface constraints and \"SomeConstrainingType<'T>\" for self-constraints. See https://aka.ms/fsharp-type-constraints. - Invalid constraint. Valid constraint forms include \"'T :> ISomeInterface\" for interface constraints and \"SomeConstrainingType<'T>\" for self-constraints. See https://aka.ms/fsharp-type-constraints. + Geçersiz kısıtlama. Geçerli kısıtlama formları arabirim kısıtlamaları için \"'T :> ISomeInterface\" ve kendi kendine kısıtlamalar için \"SomeConstrainingType<'T>\" içerir. Bkz. https://aka.ms/fsharp-type-constraints. @@ -859,7 +859,7 @@ The following required properties have to be initalized:{0} - The following required properties have to be initalized:{0} + Aşağıdaki gerekli özelliklerin başlatılması gerekiyor:{0} @@ -944,7 +944,7 @@ Cannot call '{0}' - a setter for init-only property, please use object initialization instead. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization - Cannot call '{0}' - a setter for init-only property, please use object initialization instead. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization + Yalnızca başlatma özelliği için ayarlayıcı olan '{0}' çağrılamaz, lütfen bunun yerine nesne başlatmayı kullanın. bkz. https://aka.ms/fsharp-assigning-values-to-properties-at-initialization @@ -954,27 +954,27 @@ The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. - The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. + Bu çağrı tarafından çağrılan '{0}' özelliği birden çok destek türüne sahiptir. Bu tür nitelikler için bu çağrı söz dizimine izin verilmez. Rehber için bkz. https://aka.ms/fsharp-srtp. Invocation of a static constraint should use \"'T.Ident\" and not \"^T.Ident\", even for statically resolved type parameters. - Invocation of a static constraint should use \"'T.Ident\" and not \"^T.Ident\", even for statically resolved type parameters. + Statik kısıtlamanın çağrılması statik olarak çözümlenmiş tür parametreleri için bile \"^T.Ident\" değil, \"'T.Ident\" kullanmalıdır. Trait '{0}' is not static - Trait '{0}' is not static + '{0}' niteliği statik değildir Trait '{0}' is static - Trait '{0}' is static + '{0}' niteliği statiktir A trait may not specify optional, in, out, ParamArray, CallerInfo or Quote arguments - A trait may not specify optional, in, out, ParamArray, CallerInfo or Quote arguments + Bir nitelik optional, in, out, ParamArray, CallerInfo veya Quote bağımsız değişkenlerini belirtemiyor @@ -984,12 +984,12 @@ '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. - '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. + '{0}' normalde genel kodda tür kısıtlaması olarak kullanılır, ör. \"'T when ISomeInterface<'T>\" veya \"let f (x: #ISomeInterface<_>)\". Rehber için bkz. https://aka.ms/fsharp-iwsams. '#nowarn \"3536\"' veya '--nowarn:3536' kullanarak bu uyarıyı devre dışı bırakabilirsiniz. Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. - Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. + \"interfaces with static abstract methods\" bildirimi gelişmiş bir özelliktir. Rehber için bkz. https://aka.ms/fsharp-iwsams. '#nowarn \"3535\"' veya '--nowarn:3535'. kullanarak bu uyarıyı devre dışı bırakabilirsiniz. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index 2659f03165a..34be7072109 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -189,12 +189,12 @@ static abstract interface members - static abstract interface members + 静态抽象接口成员 support for consuming init properties - support for consuming init properties + 支持使用 init 属性 @@ -204,7 +204,7 @@ Allow lowercase DU when RequireQualifiedAccess attribute - Allow lowercase DU when RequireQualifiedAccess attribute + 当 RequireQualifiedAccess 属性时允许小写 DU @@ -269,7 +269,7 @@ support for required properties - support for required properties + 对所需属性的支持 @@ -279,7 +279,7 @@ self type constraints - self type constraints + 自类型约束 @@ -329,7 +329,7 @@ The '%A' format specifier may not be used in an assembly being compiled with option '--reflectionfree'. This construct implicitly uses reflection. - The '%A' format specifier may not be used in an assembly being compiled with option '--reflectionfree'. This construct implicitly uses reflection. + "%A" 格式说明符不能在用选项 "--reflectionfree" 进行编译的程序集中使用。此构造隐式使用反射。 @@ -374,7 +374,7 @@ Used to check if an object is of the given type in a pattern or binding. - Used to check if an object is of the given type in a pattern or binding. + 用于检查对象是否属于模式或绑定中的给定类型。 @@ -474,12 +474,12 @@ Compress interface and optimization data files - Compress interface and optimization data files + 压缩接口和优化数据文件 Display the allowed values for language version. - Display the allowed values for language version. + 显示语言版本的允许值。 @@ -494,12 +494,12 @@ Specify included optimization information, the default is file. Important for distributed libraries. - Specify included optimization information, the default is file. Important for distributed libraries. + 指定包含的优化信息,默认值为文件。对于分发库非常重要。 The pdb output file name cannot match the build output filename use --pdb:filename.pdb - The pdb output file name cannot match the build output filename use --pdb:filename.pdb + pdb 输出文件名不能与生成输出文件名 use --pdb: filename.pdb 匹配 @@ -514,17 +514,17 @@ Disable implicit generation of constructs using reflection - Disable implicit generation of constructs using reflection + 使用反射禁用隐式构造生成 Specify language version such as 'latest' or 'preview'. - Specify language version such as 'latest' or 'preview'. + 指定语言版本,如 "latest" 或 "preview"。 Include F# interface information, the default is file. Essential for distributing libraries. - Include F# interface information, the default is file. Essential for distributing libraries. + 包括 F# 接口信息,默认值为文件。对于分发库必不可少。 @@ -534,12 +534,12 @@ Invalid value '{0}' for --optimizationdata, valid value are: none, file, compress. - Invalid value '{0}' for --optimizationdata, valid value are: none, file, compress. + --optimizationdata 的值 "{0}" 无效,有效值为: none、file、compress。 Invalid value '{0}' for --interfacedata, valid value are: none, file, compress. - Invalid value '{0}' for --interfacedata, valid value are: none, file, compress. + --interfacedata 的值 "{0}" 无效,有效值为: none、file、compress。 @@ -594,12 +594,12 @@ Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) - Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) + 字符文本不完整(示例: "Q")或限定类型调用(示例: "T.Name") Incomplete operator expression (example a^b) or qualified type invocation (example: ^T.Name) - Incomplete operator expression (example a^b) or qualified type invocation (example: ^T.Name) + 运算符表达式不完整(示例: a^b)或限定类型调用(示例: ^T.Name) @@ -784,7 +784,7 @@ Init-only property '{0}' cannot be set outside the initialization code. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization - Init-only property '{0}' cannot be set outside the initialization code. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization + 不能在初始化代码外部设置仅限 init 的属性 "{0}"。请参阅 https://aka.ms/fsharp-assigning-values-to-properties-at-initialization @@ -814,7 +814,7 @@ Invalid constraint. Valid constraint forms include \"'T :> ISomeInterface\" for interface constraints and \"SomeConstrainingType<'T>\" for self-constraints. See https://aka.ms/fsharp-type-constraints. - Invalid constraint. Valid constraint forms include \"'T :> ISomeInterface\" for interface constraints and \"SomeConstrainingType<'T>\" for self-constraints. See https://aka.ms/fsharp-type-constraints. + 约束无效。有效的约束形式包括 \"'T :> ISomeInterface\" (接口约束)和 \"SomeConstrainingType<'T>\" (自我约束)。请参阅 https://aka.ms/fsharp-type-constraints。 @@ -859,7 +859,7 @@ The following required properties have to be initalized:{0} - The following required properties have to be initalized:{0} + 必须初始化以下必需属性: {0} @@ -944,7 +944,7 @@ Cannot call '{0}' - a setter for init-only property, please use object initialization instead. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization - Cannot call '{0}' - a setter for init-only property, please use object initialization instead. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization + 无法调用 "{0}",它是仅限 init 属性的资源库,请改用对象初始化。请参阅 https://aka.ms/fsharp-assigning-values-to-properties-at-initialization @@ -954,27 +954,27 @@ The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. - The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. + 此调用过程调用的特征 "{0}" 具有多种支持类型。此类特征不允许使用此调用语法。有关指南,请参阅 https://aka.ms/fsharp-srtp。 Invocation of a static constraint should use \"'T.Ident\" and not \"^T.Ident\", even for statically resolved type parameters. - Invocation of a static constraint should use \"'T.Ident\" and not \"^T.Ident\", even for statically resolved type parameters. + 调用静态约束应使用 \"'T.Ident\" 而不是 \"^T.Ident\",即使对于静态解析的类型参数也是如此。 Trait '{0}' is not static - Trait '{0}' is not static + 特征 "{0}" 不是静态的 Trait '{0}' is static - Trait '{0}' is static + 特征 "{0}" 是静态的 A trait may not specify optional, in, out, ParamArray, CallerInfo or Quote arguments - A trait may not specify optional, in, out, ParamArray, CallerInfo or Quote arguments + 特征不能指定 option、in、out、ParamArray、CallerInfo 或 Quote 参数 @@ -984,12 +984,12 @@ '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. - '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. + "{0}" 通常用作泛型代码中的类型约束,例如 \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\"。有关指南,请参阅 https://aka.ms/fsharp-iwsams。可以使用 '#nowarn \"3536\"' 或 '--nowarn:3536' 禁用此警告。 Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. - Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. + 声明“使用静态抽象方法的接口”是一项高级功能。有关指南,请参阅 https://aka.ms/fsharp-iwsams。可以使用 "#nowarn \"3535\"' 或 '--nowarn:3535' 禁用此警告。 diff --git a/src/Compiler/xlf/FSStrings.cs.xlf b/src/Compiler/xlf/FSStrings.cs.xlf index f80da09f758..bdf7cf1baa1 100644 --- a/src/Compiler/xlf/FSStrings.cs.xlf +++ b/src/Compiler/xlf/FSStrings.cs.xlf @@ -9,7 +9,7 @@ Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute - Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + Případy sjednocení s malými písmeny jsou povolené jenom při použití atributu RequireQualifiedAccess. diff --git a/src/Compiler/xlf/FSStrings.de.xlf b/src/Compiler/xlf/FSStrings.de.xlf index 8978b176751..1662a9afc0f 100644 --- a/src/Compiler/xlf/FSStrings.de.xlf +++ b/src/Compiler/xlf/FSStrings.de.xlf @@ -9,7 +9,7 @@ Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute - Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + Diskriminierte Union-Fälle in Kleinbuchstaben sind nur zulässig, wenn das RequireQualifiedAccess-Attribut verwendet wird. diff --git a/src/Compiler/xlf/FSStrings.es.xlf b/src/Compiler/xlf/FSStrings.es.xlf index bc0ce4ad5a8..4ca6ad72d0f 100644 --- a/src/Compiler/xlf/FSStrings.es.xlf +++ b/src/Compiler/xlf/FSStrings.es.xlf @@ -9,7 +9,7 @@ Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute - Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + Los casos de unión discriminada en minúsculas solo se permiten cuando se usa el atributo RequireQualifiedAccess diff --git a/src/Compiler/xlf/FSStrings.fr.xlf b/src/Compiler/xlf/FSStrings.fr.xlf index f88d8e7182b..0b1d980d8b3 100644 --- a/src/Compiler/xlf/FSStrings.fr.xlf +++ b/src/Compiler/xlf/FSStrings.fr.xlf @@ -9,7 +9,7 @@ Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute - Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + Les cas d’union discriminée en minuscules sont uniquement autorisés lors de l’utilisation de l’attribut RequireQualifiedAccess. diff --git a/src/Compiler/xlf/FSStrings.it.xlf b/src/Compiler/xlf/FSStrings.it.xlf index 90d7b1611ff..bb186e7c64d 100644 --- a/src/Compiler/xlf/FSStrings.it.xlf +++ b/src/Compiler/xlf/FSStrings.it.xlf @@ -9,7 +9,7 @@ Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute - Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + I casi di unione discriminati minuscoli sono consentiti solo quando si usa l'attributo RequireQualifiedAccess diff --git a/src/Compiler/xlf/FSStrings.ko.xlf b/src/Compiler/xlf/FSStrings.ko.xlf index 95015040f09..a7c0f529c55 100644 --- a/src/Compiler/xlf/FSStrings.ko.xlf +++ b/src/Compiler/xlf/FSStrings.ko.xlf @@ -9,7 +9,7 @@ Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute - Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + 소문자로 구분된 공용 구조체 케이스는 RequireQualifiedAccess 특성을 사용하는 경우에만 허용됩니다. diff --git a/src/Compiler/xlf/FSStrings.pl.xlf b/src/Compiler/xlf/FSStrings.pl.xlf index 48a2f8adedc..8de02a886a6 100644 --- a/src/Compiler/xlf/FSStrings.pl.xlf +++ b/src/Compiler/xlf/FSStrings.pl.xlf @@ -9,7 +9,7 @@ Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute - Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + Przypadki unii z dyskryminatorem z małymi literami są dozwolone tylko w przypadku używania atrybutu RequireQualifiedAccess diff --git a/src/Compiler/xlf/FSStrings.tr.xlf b/src/Compiler/xlf/FSStrings.tr.xlf index 31b4cad81af..af51d07edbd 100644 --- a/src/Compiler/xlf/FSStrings.tr.xlf +++ b/src/Compiler/xlf/FSStrings.tr.xlf @@ -9,7 +9,7 @@ Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute - Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + Küçük harf ayrımlı birleşim durumlarına yalnızca RequireQualifiedAccess özniteliği kullanılırken izin verilir diff --git a/src/Compiler/xlf/FSStrings.zh-Hans.xlf b/src/Compiler/xlf/FSStrings.zh-Hans.xlf index be3604df4bf..f90ed1f41f2 100644 --- a/src/Compiler/xlf/FSStrings.zh-Hans.xlf +++ b/src/Compiler/xlf/FSStrings.zh-Hans.xlf @@ -9,7 +9,7 @@ Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute - Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute + 仅当使用 RequireQualifiedAccess 属性时才允许区分小写的联合事例 From 4c4c3894bb118332e036ad99fcff1de89d6af307 Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Mon, 26 Sep 2022 09:03:12 -0700 Subject: [PATCH 23/51] Merge main to release/dev17.4 (#13980) Co-authored-by: Edgar Gonzalez Co-authored-by: Vlad Zarytovskii --- src/Compiler/Checking/NicePrint.fs | 14 ------------- src/Compiler/TypedTree/TypedTreeOps.fs | 16 +------------- src/Compiler/TypedTree/TypedTreeOps.fsi | 3 --- .../Signatures/ArrayTests.fs | 21 +++++++++---------- 4 files changed, 11 insertions(+), 43 deletions(-) diff --git a/src/Compiler/Checking/NicePrint.fs b/src/Compiler/Checking/NicePrint.fs index dbbe333b9cd..b7b4cce955f 100644 --- a/src/Compiler/Checking/NicePrint.fs +++ b/src/Compiler/Checking/NicePrint.fs @@ -875,16 +875,6 @@ module PrintTypes = | [] -> tcL | [arg] -> layoutTypeWithInfoAndPrec denv env 2 arg ^^ tcL | args -> bracketIfL (prec <= 1) (bracketL (layoutTypesWithInfoAndPrec denv env 2 (sepL (tagPunctuation ",")) args) --- tcL) - - and layoutTypeForGenericMultidimensionalArrays denv env prec tcref innerT level = - let innerLayout = layoutTypeWithInfoAndPrec denv env prec innerT - - let arrayLayout = - tagEntityRefName denv tcref $"array{level}d" - |> mkNav tcref.DefinitionRange - |> wordL - - innerLayout ^^ arrayLayout /// Layout a type, taking precedence into account to insert brackets where needed and layoutTypeWithInfoAndPrec denv env prec ty = @@ -906,10 +896,6 @@ module PrintTypes = // Always prefer 'float' to 'float<1>' | TType_app (tc, args, _) when tc.IsMeasureableReprTycon && List.forall (isDimensionless g) args -> layoutTypeWithInfoAndPrec denv env prec (reduceTyconRefMeasureableOrProvided g tc args) - - // Special case for nested array> shape - | TTypeMultiDimensionalArrayAsGeneric (tcref, innerT, level) -> - layoutTypeForGenericMultidimensionalArrays denv env prec tcref innerT level // Layout a type application | TType_ucase (UnionCaseRef(tc, _), args) diff --git a/src/Compiler/TypedTree/TypedTreeOps.fs b/src/Compiler/TypedTree/TypedTreeOps.fs index bc037c8af7e..c166230e718 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.fs @@ -10410,18 +10410,4 @@ let (|EmptyModuleOrNamespaces|_|) (moduleOrNamespaceContents: ModuleOrNamespaceC Some emptyModuleOrNamespaces else None - | _ -> None - -let (|TTypeMultiDimensionalArrayAsGeneric|_|) (t: TType) = - let rec (|Impl|_|) t = - match t with - | TType_app(tc, [Impl(outerTc, innerT, currentLevel)], _) when tc.DisplayNameCore = "array" -> - Some (outerTc, innerT, currentLevel + 1) - | TType_app(tc, [arg], _) when tc.DisplayNameCore = "array" -> - Some (tc, arg, 1) - | _ -> None - - match t with - | Impl (tc, arg, level) -> - if level > 2 then Some (tc, arg, level) else None - | _ -> None + | _ -> None \ No newline at end of file diff --git a/src/Compiler/TypedTree/TypedTreeOps.fsi b/src/Compiler/TypedTree/TypedTreeOps.fsi index 403498c5417..00d838e04d4 100755 --- a/src/Compiler/TypedTree/TypedTreeOps.fsi +++ b/src/Compiler/TypedTree/TypedTreeOps.fsi @@ -2687,6 +2687,3 @@ type TraitConstraintInfo with /// This will match anything that does not have any types or bindings. val (|EmptyModuleOrNamespaces|_|): moduleOrNamespaceContents: ModuleOrNamespaceContents -> (ModuleOrNamespace list) option - -/// Captures an application type with a multi-dimensional array as postfix. -val (|TTypeMultiDimensionalArrayAsGeneric|_|): t: TType -> (TyconRef * TType * int) option diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/ArrayTests.fs b/tests/FSharp.Compiler.ComponentTests/Signatures/ArrayTests.fs index 2317005032f..da6c65b1c82 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/ArrayTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/ArrayTests.fs @@ -32,17 +32,16 @@ let ``4 dimensional array`` () = "val a: int array4d" [] -let ``5 till 32 dimensional array`` () = - [ 5 .. 32 ] - |> List.iter (fun idx -> - let arrayType = - [ 1 .. idx ] - |> List.fold (fun acc _ -> $"array<{acc}>") "int" - - assertSingleSignatureBinding - $"let a : {arrayType} = failwith \"todo\"" - $"val a: int array{idx}d" - ) +let ``jagged array 1`` () = + assertSingleSignatureBinding + "let a : array>>>> = failwith \"todo\"" + "val a: int array array array array array" + +[] +let ``jagged array 2`` () = + assertSingleSignatureBinding + "let a: int[][][][][] = failwith \"todo\"" + "val a: int array array array array array" [] let ``Use array2d syntax in implementation`` () = From 7669e0a6dbeb872512c073c49c7661a71cfb6e07 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Tue, 27 Sep 2022 11:05:24 +0100 Subject: [PATCH 24/51] Cherry pick #13987 to 17.4 (#13988) --- src/Compiler/Utilities/illib.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Compiler/Utilities/illib.fs b/src/Compiler/Utilities/illib.fs index 6eab1b08508..49cef8a36a9 100644 --- a/src/Compiler/Utilities/illib.fs +++ b/src/Compiler/Utilities/illib.fs @@ -610,7 +610,7 @@ module ResizeArray = // * doing a block copy using `List.CopyTo(index, array, index, count)` (requires more copies to do the mapping) // none are significantly better. for i in 0 .. takeCount - 1 do - holder[i] <- f items[i] + holder[i] <- f items[startIndex + i] yield holder |] From f07ccb1bc4325861cb4306733f59b23f6d4344f7 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Thu, 6 Oct 2022 18:47:59 +0100 Subject: [PATCH 25/51] fix regression in editing .NET Core scripts in devenv.exe (#13994) * fix regression in editing scripts in devenv.exe * fix regression in editing scripts in devenv.exe * fix regression in editing scripts in devenv.exe * fix regression in editing scripts in devenv.exe * add tests --- src/Compiler/Driver/CompilerImports.fs | 1 + src/Compiler/Driver/FxResolver.fs | 61 ++++++++++++++++--- tests/service/ScriptOptionsTests.fs | 29 ++++++++- .../FSharpProjectOptionsManager.fs | 2 +- .../src/FSharp.VS.FSI/fsiLanguageService.fs | 10 +-- 5 files changed, 87 insertions(+), 16 deletions(-) diff --git a/src/Compiler/Driver/CompilerImports.fs b/src/Compiler/Driver/CompilerImports.fs index 56513446bd3..a329635b609 100644 --- a/src/Compiler/Driver/CompilerImports.fs +++ b/src/Compiler/Driver/CompilerImports.fs @@ -2142,6 +2142,7 @@ and [] TcImports CheckDisposed() let tcConfig = tcConfigP.Get ctok + let runMethod = match tcConfig.parallelReferenceResolution with | ParallelReferenceResolution.On -> NodeCode.Parallel diff --git a/src/Compiler/Driver/FxResolver.fs b/src/Compiler/Driver/FxResolver.fs index 2fa595ee15b..ae69346d689 100644 --- a/src/Compiler/Driver/FxResolver.fs +++ b/src/Compiler/Driver/FxResolver.fs @@ -382,16 +382,16 @@ type internal FxResolver let tryGetNetCoreRefsPackDirectoryRoot () = tryNetCoreRefsPackDirectoryRoot.Force() + let getTfmNumber (v: string) = + let arr = v.Split([| '.' |], 3) + arr[0] + "." + arr[1] + // Tries to figure out the tfm for the compiler instance. // On coreclr it uses the deps.json file // // On-demand because (a) some FxResolver are ephemeral (b) we want to avoid recomputation - let tryGetRunningTfm = + let tryGetRunningTfm () = let runningTfmOpt = - let getTfmNumber (v: string) = - let arr = v.Split([| '.' |], 3) - arr[0] + "." + arr[1] - // Compute TFM from System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription // System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription;; // val it: string = ".NET 6.0.7" @@ -548,6 +548,24 @@ type internal FxResolver assemblyReferences |> List.iter traverseDependencies assemblies + let tryGetTfmFromSdkDir (sdkDir: string) = + let dotnetConfigFile = Path.Combine(sdkDir, "dotnet.runtimeconfig.json") + + try + use stream = FileSystem.OpenFileForReadShim(dotnetConfigFile) + let dotnetConfig = stream.ReadAllText() + let pattern = "\"tfm\": \"" + + let startPos = + dotnetConfig.IndexOf(pattern, StringComparison.OrdinalIgnoreCase) + + pattern.Length + + let endPos = dotnetConfig.IndexOf("\"", startPos) + let tfm = dotnetConfig[startPos .. endPos - 1] + tfm + with _ -> + tryGetRunningTfm () + // This list is the default set of references for "non-project" files. // // These DLLs are @@ -806,12 +824,37 @@ type internal FxResolver RequireFxResolverLock(fxtok, "assuming all member require lock") tryGetSdkDir () |> replayWarnings) - /// Gets the selected target framework moniker, e.g netcore3.0, net472, and the running rid of the current machine + /// Gets + /// 1. The Target Framework Moniker (TFM) used for scripting (e.g netcore3.0, net472) + /// 2. The running RID of the current machine (e.g. win-x64) + /// + /// When analyzing scripts for editing, this is **not** necessarily the running TFM. Rather, it is the TFM to use for analysing + /// a script. + /// + /// Summary: + /// - When running scripts (isInteractive = true) this is identical to the running TFM. + /// + /// - When analyzing .NET Core scripts (isInteractive = false, tryGetSdkDir is Some), + /// the scripting TFM is determined from dotnet.runtimeconfig.json in the SDK directory + /// + /// - Otherwise, the running TFM is used. That is, if editing with .NET Framework/Core-based tooling a script is assumed + /// to be .NET Framework/Core respectively. + /// + /// The RID returned is always the RID of the running machine. member _.GetTfmAndRid() = fxlock.AcquireLock(fun fxtok -> RequireFxResolverLock(fxtok, "assuming all member require lock") - let runningTfm = tryGetRunningTfm + // Interactive processes read their own configuration to find the running tfm + let targetTfm = + if isInteractive then + tryGetRunningTfm () + else + let sdkDir = tryGetSdkDir () |> replayWarnings + + match sdkDir with + | Some dir -> tryGetTfmFromSdkDir dir + | None -> tryGetRunningTfm () // Coreclr has mechanism for getting rid // System.Runtime.InteropServices.RuntimeInformation.RuntimeIdentifier @@ -862,7 +905,7 @@ type internal FxResolver | Architecture.Arm64 -> baseRid + "-arm64" | _ -> baseRid + "-arm" - runningTfm, runningRid) + targetTfm, runningRid) static member ClearStaticCaches() = desiredDotNetSdkVersionForDirectoryCache.Clear() @@ -885,7 +928,7 @@ type internal FxResolver let defaultReferences = if assumeDotNetFramework then getDotNetFrameworkDefaultReferences useFsiAuxLib, assumeDotNetFramework - else if useSdkRefs then + elif useSdkRefs then // Go fetch references let sdkDir = tryGetSdkRefsPackDirectory () |> replayWarnings diff --git a/tests/service/ScriptOptionsTests.fs b/tests/service/ScriptOptionsTests.fs index a533d7ac4c8..998120a81d4 100644 --- a/tests/service/ScriptOptionsTests.fs +++ b/tests/service/ScriptOptionsTests.fs @@ -24,11 +24,12 @@ let pi = Math.PI """ [] +[] [] [] let ``can generate options for different frameworks regardless of execution environment``(assumeNetFx, useSdk, flags) = let path = Path.GetTempPath() - let file = tryCreateTemporaryFileName () + let file = tryCreateTemporaryFileName () + ".fsx" let tempFile = Path.Combine(path, file) let _, errors = checker.GetProjectOptionsFromScript(tempFile, SourceText.ofString scriptSource, assumeDotNetFramework = assumeNetFx, useSdkRefs = useSdk, otherFlags = flags) @@ -37,6 +38,32 @@ let ``can generate options for different frameworks regardless of execution envi | [] -> () | errors -> failwithf "Error while parsing script with assumeDotNetFramework:%b, useSdkRefs:%b, and otherFlags:%A:\n%A" assumeNetFx useSdk flags errors +#if NETFRAMEWORK +// See https://github.com/dotnet/fsharp/pull/13994#issuecomment-1259663865 +// +// .NET Core-based tooling can't resolve nuget packages to .NET Framework references +[] +#endif +[] +[] +let ``can resolve nuget packages to right target framework for different frameworks regardless of execution environment``(assumeNetFx, useSdk, flags) = + let path = Path.GetTempPath() + let file = tryCreateTemporaryFileName () + ".fsx" + let tempFile = Path.Combine(path, file) + let scriptSource = """ +#r "nuget: FSharp.Data, 3.3.3" +open System +let pi = Math.PI +""" + let options, errors = + checker.GetProjectOptionsFromScript(tempFile, SourceText.ofString scriptSource, assumeDotNetFramework = assumeNetFx, useSdkRefs = useSdk, otherFlags = flags) + |> Async.RunImmediate + match errors with + | [] -> () + | errors -> failwithf "Error while parsing script with assumeDotNetFramework:%b, useSdkRefs:%b, and otherFlags:%A:\n%A" assumeNetFx useSdk flags errors + let expectedReferenceText = (if assumeNetFx then "net45" else "netstandard2.0") + let found = options.OtherOptions |> Array.exists (fun s -> s.Contains(expectedReferenceText) && s.Contains("FSharp.Data.dll")) + Assert.IsTrue(found) // This test atempts to use a bad SDK number 666.666.666 // diff --git a/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs b/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs index 815fab5e904..92d2cefaae5 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs @@ -182,7 +182,7 @@ type private FSharpProjectOptionsReactor (checker: FSharpChecker) = let! scriptProjectOptions, _ = checker.GetProjectOptionsFromScript(document.FilePath, sourceText.ToFSharpSourceText(), - SessionsProperties.fsiPreview, + previewEnabled=SessionsProperties.fsiPreview, assumeDotNetFramework=not SessionsProperties.fsiUseNetCore, userOpName=userOpName) diff --git a/vsintegration/src/FSharp.VS.FSI/fsiLanguageService.fs b/vsintegration/src/FSharp.VS.FSI/fsiLanguageService.fs index 8de6290a979..b943d3cca13 100644 --- a/vsintegration/src/FSharp.VS.FSI/fsiLanguageService.fs +++ b/vsintegration/src/FSharp.VS.FSI/fsiLanguageService.fs @@ -46,6 +46,11 @@ type FsiPropertyPage() = [] member this.FsiShadowCopy with get() = SessionsProperties.fsiShadowCopy and set (x:bool) = SessionsProperties.fsiShadowCopy <- x + [] + [] + [] + member this.FsiUseNetCore with get() = SessionsProperties.fsiUseNetCore and set (x:bool) = SessionsProperties.fsiUseNetCore <- x + [] [] [] @@ -56,11 +61,6 @@ type FsiPropertyPage() = [] member this.FsiPreview with get() = SessionsProperties.fsiPreview and set (x:bool) = SessionsProperties.fsiPreview <- x - [] - [] - [] - member this.FsiUseNetCore with get() = SessionsProperties.fsiUseNetCore and set (x:bool) = SessionsProperties.fsiUseNetCore <- x - // CompletionSet type internal FsiCompletionSet(imageList,source:Source) = inherit CompletionSet(imageList, source) From 20cfdba41b322f13ce5504f416cb74d5ffff678e Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Fri, 7 Oct 2022 12:09:55 +0200 Subject: [PATCH 26/51] Update branch versions --- azure-pipelines.yml | 6 +++--- eng/Versions.props | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d7a5ca159a7..c99abde0974 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -84,11 +84,11 @@ stages: # Signed build # #-------------------------------------------------------------------------------------------------------------------# - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/release/dev17.4') }}: + - ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/release/dev17.5') }}: - template: /eng/common/templates/job/onelocbuild.yml parameters: MirrorRepo: fsharp - MirrorBranch: release/dev17.4 + MirrorBranch: release/dev17.5 LclSource: lclFilesfromPackage LclPackageId: 'LCL-JUNO-PROD-FSHARP' - template: /eng/common/templates/jobs/jobs.yml @@ -727,7 +727,7 @@ stages: - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - template: eng/release/insert-into-vs.yml parameters: - componentBranchName: refs/heads/release/dev17.4 + componentBranchName: refs/heads/release/dev17.5 insertTargetBranch: main insertTeamEmail: fsharpteam@microsoft.com diff --git a/eng/Versions.props b/eng/Versions.props index 544cc475da3..77ef1f20a9a 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -33,7 +33,7 @@ 42 7 - 100 + 200 $(FSRevisionVersion) $(FCSMajorVersion).$(FCSMinorVersion).$(FCSBuildVersion) $(FCSMajorVersion).$(FCSMinorVersion).$(FCSBuildVersion).$(FCSRevisionVersion) @@ -57,7 +57,7 @@ 17 - 4 + 5 $(VSMajorVersion).0 $(VSMajorVersion).$(VSMinorVersion).0 From 04fa10a77431d9235c8a92ef2ae63ca6fd958a20 Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Fri, 7 Oct 2022 12:12:20 +0200 Subject: [PATCH 27/51] Update target branch for 17.4 to rel/d17.4 --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d7a5ca159a7..2b2fcca507c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -728,7 +728,7 @@ stages: - template: eng/release/insert-into-vs.yml parameters: componentBranchName: refs/heads/release/dev17.4 - insertTargetBranch: main + insertTargetBranch: rel/d17.4 insertTeamEmail: fsharpteam@microsoft.com insertTeamName: 'F#' From e587e255611a5d693ed590087d682ae5470a4a90 Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Fri, 7 Oct 2022 07:59:28 -0700 Subject: [PATCH 28/51] Update target branch for 17.4 to rel/d17.4 (#14042) Co-authored-by: Vlad Zarytovskii From 532a074f9b304325d8bcd554ac73a1183b74a8f0 Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Fri, 7 Oct 2022 07:59:47 -0700 Subject: [PATCH 29/51] Localized file check-in by OneLocBuild Task: Build definition ID 499: Build ID 1997730 (#13925) (#14041) Co-authored-by: Vlad Zarytovskii --- src/Compiler/xlf/FSComp.txt.cs.xlf | 2 +- src/Compiler/xlf/FSComp.txt.de.xlf | 2 +- src/Compiler/xlf/FSComp.txt.es.xlf | 2 +- src/Compiler/xlf/FSComp.txt.fr.xlf | 2 +- src/Compiler/xlf/FSComp.txt.it.xlf | 2 +- src/Compiler/xlf/FSComp.txt.ja.xlf | 2 +- src/Compiler/xlf/FSComp.txt.ko.xlf | 2 +- src/Compiler/xlf/FSComp.txt.pl.xlf | 2 +- src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 2 +- src/Compiler/xlf/FSComp.txt.ru.xlf | 2 +- src/Compiler/xlf/FSComp.txt.tr.xlf | 2 +- src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 2 +- src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index 822297d4ff9..9dbc32b4b15 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Používá se ve vzájemně rekurzivních vazbách, v deklaracích vlastností a s několika omezeními u generických parametrů. + Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index afb89b3f305..fcfdbb8afb0 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Wird in gegenseitig rekursiven Bindungen, in Eigenschaftendeklarationen und bei mehreren Beschränkungen in Bezug auf generische Parameter verwendet. + Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index 7bff656b19d..b11d915ab39 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Se usa en enlaces mutuamente recursivos, en declaraciones de propiedad y con varias restricciones en parámetros genéricos. + Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index 9e4bb29ee0c..cb36f32b1f0 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Utilisé dans les liaisons mutuellement récursives, dans les déclarations de propriété et avec plusieurs contraintes sur des paramètres génériques. + Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 6e56bbe7ee8..766e0e30348 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Usata in binding ricorsivi reciproci, dichiarazioni di proprietà e con più vincoli su parametri generici. + Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index 18b818fea07..433aa7af0f5 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - 相互に再帰的なバインディング、プロパティの宣言、およびジェネリック パラメーターの複数の制約に使用します。 + Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 052d424f56f..2e326e9ecf1 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - 상호 재귀적 바인딩과 속성 선언에 사용되며 제네릭 매개 변수의 여러 제약 조건과 함께 사용됩니다. + Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index eb4a2819499..7fc1f4bbf36 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Używane w powiązaniach wzajemnie cyklicznych, deklaracjach właściwości oraz z wieloma ograniczeniami parametrów ogólnych. + Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 04e91c3089b..292cef9ae5d 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Usado em associações mutualmente recursivas, em declarações de propriedade e em múltiplas restrições em parâmetros genéricos. + Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index 29bdaf2512e..995169db4e7 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Используется во взаимно рекурсивных привязках, объявлениях свойств и с несколькими ограничениями для универсальных параметров. + Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index 4b1b2804206..865ff430c4a 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Karşılıklı yinelemeli bağlamalarda, özellik bildirimlerinde ve genel parametreler üzerinde birden çok kısıtlamayla kullanılır. + Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index 653c27378ca..66ca6254000 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - 用于互相递归绑定、属性声明,并用于对泛型参数的多个约束。 + Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index 781002375e3..aee1dd1ed12 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - 用於互相遞迴的繫結、屬性宣告,以及搭配泛型參數的多個條件約束。 + Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. From 507f1f4a712c52b322062397515ffdd7907d5cfa Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Fri, 7 Oct 2022 08:01:26 -0700 Subject: [PATCH 30/51] Merge main to release/dev17.5 (#14043) Co-authored-by: Vlad Zarytovskii Co-authored-by: Don Syme Co-authored-by: Tomas Grosup Co-authored-by: Edgar Gonzalez Co-authored-by: Eugene Auduchinok Co-authored-by: Chet Husk Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Florian Verdonck Co-authored-by: Petr Co-authored-by: Petr Pokorny Co-authored-by: Theodore Tsirpanis --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/ISSUE_TEMPLATE/bug_report.yml | 69 ------ .github/ISSUE_TEMPLATE/feature_request.md | 2 +- .github/ISSUE_TEMPLATE/other_issue.md | 10 + DEVGUIDE.md | 8 +- README.md | 11 +- eng/Version.Details.xml | 8 +- eng/common/cross/build-rootfs.sh | 7 +- eng/common/init-tools-native.ps1 | 1 + eng/common/templates/job/execute-sdl.yml | 2 +- eng/common/templates/job/job.yml | 4 + eng/common/templates/jobs/source-build.yml | 2 +- .../templates/post-build/post-build.yml | 4 +- eng/common/templates/steps/generate-sbom.yml | 4 + eng/common/templates/steps/source-build.yml | 6 + global.json | 4 +- src/Compiler/Checking/AttributeChecking.fs | 6 +- src/Compiler/Checking/AttributeChecking.fsi | 2 + src/Compiler/Checking/CheckDeclarations.fs | 1 + src/Compiler/Checking/CheckExpressions.fs | 4 +- src/Compiler/Checking/CheckPatterns.fs | 26 +- .../Checking/PatternMatchCompilation.fs | 8 +- src/Compiler/Checking/infos.fs | 24 +- src/Compiler/Checking/infos.fsi | 3 + src/Compiler/Driver/CompilerConfig.fs | 13 +- src/Compiler/Driver/FxResolver.fs | 15 +- src/Compiler/Driver/FxResolver.fsi | 6 +- src/Compiler/FSComp.txt | 4 +- src/Compiler/Service/FSharpCheckerResults.fs | 6 +- .../Service/ServiceDeclarationLists.fs | 2 +- .../Service/ServiceDeclarationLists.fsi | 2 +- src/Compiler/Service/ServiceLexing.fs | 8 +- src/Compiler/Service/ServiceLexing.fsi | 2 +- src/Compiler/Service/ServiceParseTreeWalk.fs | 5 +- src/Compiler/Service/ServiceParsedInputOps.fs | 12 +- src/Compiler/Service/ServiceXmlDocParser.fs | 1 + src/Compiler/Symbols/Symbols.fs | 11 +- src/Compiler/SyntaxTree/ParseHelpers.fs | 3 + src/Compiler/SyntaxTree/SyntaxTree.fs | 7 +- src/Compiler/SyntaxTree/SyntaxTree.fsi | 5 +- src/Compiler/SyntaxTree/SyntaxTreeOps.fs | 7 + src/Compiler/SyntaxTree/SyntaxTreeOps.fsi | 2 + src/Compiler/SyntaxTree/SyntaxTrivia.fs | 8 + src/Compiler/SyntaxTree/SyntaxTrivia.fsi | 19 ++ src/Compiler/TypedTree/TypedTree.fs | 2 +- src/Compiler/pars.fsy | 118 +++++++-- src/Compiler/xlf/FSComp.txt.cs.xlf | 14 +- src/Compiler/xlf/FSComp.txt.de.xlf | 14 +- src/Compiler/xlf/FSComp.txt.es.xlf | 14 +- src/Compiler/xlf/FSComp.txt.fr.xlf | 14 +- src/Compiler/xlf/FSComp.txt.it.xlf | 14 +- src/Compiler/xlf/FSComp.txt.ja.xlf | 14 +- src/Compiler/xlf/FSComp.txt.ko.xlf | 14 +- src/Compiler/xlf/FSComp.txt.pl.xlf | 14 +- src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 14 +- src/Compiler/xlf/FSComp.txt.ru.xlf | 14 +- src/Compiler/xlf/FSComp.txt.tr.xlf | 14 +- src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 14 +- src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 14 +- src/FSharp.Core/prim-types.fs | 17 +- .../CompilerOptions/fsc/warn.fs | 12 + .../Attributes/Diags/Diags.fs | 4 +- .../Attributes/Legacy/Legacy.fs | 110 ++++----- .../AttributeUsage/AttributeUsage.fs | 10 +- .../CustomAttributes/Basic/Basic.fs | 8 +- .../LetBindings/Basic/Basic.fs | 4 +- .../StructDefensiveCopy.fs | 158 ++++++++++++ .../UnionCasePatternMatchingErrors.fs | 72 ++++++ .../ErrorMessages/UnsupportedAttributes.fs | 4 +- .../FSharp.Compiler.ComponentTests.fsproj | 2 + .../ObsoleteAttributeCheckingTests.fs | 104 +++++++- .../fsc/warn/nowarn_readonlystruct.fs | 9 + .../CompilerOptions/fsc/warn/warn_level5.fs | 12 +- .../FSharp.Compiler.Service.Tests.fsproj | 9 + ...erService.SurfaceArea.netstandard.expected | 34 ++- tests/fsharp/tests.fs | 15 ++ tests/fsharp/typecheck/sigs/neg20.bsl | 8 +- tests/fsharp/typecheck/sigs/neg31.bsl | 12 +- tests/fsharp/typecheck/sigs/neg32.bsl | 2 +- tests/fsharp/typecheck/sigs/pos1281.fs | 17 ++ tests/fsharp/typecheck/sigs/pos3294.fs | 8 + .../fsharp/typecheck/sigs/version50/neg20.bsl | 8 +- .../AttributeMatching01.fs | 2 +- .../AttributeMatching01.fsi | 2 +- tests/fsharpqa/Source/Misc/E_CompiledName.fs | 4 +- tests/service/Common.fs | 7 +- tests/service/ParserTests.fs | 157 +++++++++++- tests/service/PatternMatchCompilationTests.fs | 69 +----- .../service/SyntaxTreeTests/AttributeTests.fs | 50 ++++ tests/service/SyntaxTreeTests/ExternTests.fs | 21 ++ tests/service/SyntaxTreeTests/MemberTests.fs | 225 ++++++++++++++++++ tests/service/SyntaxTreeTests/PatternTests.fs | 50 +++- tests/service/SyntaxTreeTests/TypeTests.fs | 199 +--------------- .../CodeLens/CodeLensGeneralTagger.fs | 191 --------------- .../CodeLens/CodeLensProvider.fs | 81 ++----- .../CodeLens/FSharpCodeLensService.fs | 32 +-- .../CodeLens/LineLensDisplayService.fs | 21 +- .../src/FSharp.Editor/FSharp.Editor.fsproj | 1 - .../LanguageService/LanguageService.fs | 33 ++- .../FSharp.Editor/Options/EditorOptions.fs | 8 +- .../CodeLensOptionControl.xaml | 3 - .../FSharp.UIResources.csproj | 15 ++ ...nguageServicePerformanceOptionControl.xaml | 31 +-- .../FSharp.UIResources/Strings.Designer.cs | 37 +-- .../src/FSharp.UIResources/Strings.resx | 15 +- .../src/FSharp.UIResources/xlf/Strings.cs.xlf | 25 +- .../src/FSharp.UIResources/xlf/Strings.de.xlf | 25 +- .../src/FSharp.UIResources/xlf/Strings.es.xlf | 25 +- .../src/FSharp.UIResources/xlf/Strings.fr.xlf | 25 +- .../src/FSharp.UIResources/xlf/Strings.it.xlf | 25 +- .../src/FSharp.UIResources/xlf/Strings.ja.xlf | 25 +- .../src/FSharp.UIResources/xlf/Strings.ko.xlf | 25 +- .../src/FSharp.UIResources/xlf/Strings.pl.xlf | 25 +- .../FSharp.UIResources/xlf/Strings.pt-BR.xlf | 25 +- .../src/FSharp.UIResources/xlf/Strings.ru.xlf | 25 +- .../src/FSharp.UIResources/xlf/Strings.tr.xlf | 25 +- .../xlf/Strings.zh-Hans.xlf | 25 +- .../xlf/Strings.zh-Hant.xlf | 25 +- 118 files changed, 1807 insertions(+), 1069 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/other_issue.md create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/StructDefensiveCopy/StructDefensiveCopy.fs create mode 100644 tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnionCasePatternMatchingErrors.fs create mode 100644 tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/warn/nowarn_readonlystruct.fs create mode 100644 tests/fsharp/typecheck/sigs/pos1281.fs create mode 100644 tests/fsharp/typecheck/sigs/pos3294.fs create mode 100644 tests/service/SyntaxTreeTests/AttributeTests.fs create mode 100644 tests/service/SyntaxTreeTests/ExternTests.fs create mode 100644 tests/service/SyntaxTreeTests/MemberTests.fs delete mode 100644 vsintegration/src/FSharp.Editor/CodeLens/CodeLensGeneralTagger.fs diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 6c1de31c1b2..6a22a1cca73 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -2,7 +2,7 @@ name: Bug report about: Create a report to help us improve F# title: '' -labels: Bug +labels: [Bug, Needs-Triage] assignees: '' --- diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml deleted file mode 100644 index f10d1a55e5a..00000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Bug report -description: Create a report to help us improve F# -title: "`Bug`: " -labels: [Needs Triage] -body: -- type: checkboxes - attributes: - label: Is there an existing issue for this? - description: Please search to see if an issue already exists for the bug you encountered. - options: - - label: I have searched the existing issues - required: true -- type: textarea - attributes: - label: Issue description - description: Please provide a succinct description of the issue you're experiencing. - validations: - required: true -- type: textarea - attributes: - label: Steps To Reproduce - description: Provide the steps required to reproduce the problem. - placeholder: | - 1. Step A - 2. Step B... - validations: - required: false -- type: textarea - attributes: - label: Expected Behavior - description: Provide a description of the expected behavior. - validations: - required: true -- type: textarea - attributes: - label: Actual Behavior - description: Provide a description of the actual behaviour observed. - validations: - required: true -- type: textarea - attributes: - label: Known workarounds - description: Provide a description of the actual behaviour observed. - validations: - required: false -- type: textarea - attributes: - label: Related information - description: | - Provide any related information (optional), examples: - - **OS**: Windows 11 - - **.NET Runtime Kind and version**: .NET Framework 4.8 and .NET 7 - - **Tooling**: Visual Studio 2022 - value: | - - OS: - - .NET Runtime Kind and version: - - Tooling: - render: markdown - validations: - required: false -- type: textarea - attributes: - label: Anything else? - description: | - Links? References? Anything that will give us more context about the issue you are encountering! - - Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in. - validations: - required: false diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 1397683d28c..9902369d951 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -2,7 +2,7 @@ name: Feature request about: Suggest an idea for the F# tools or compiler title: '' -labels: Feature Request +labels: [Feature Request, Needs-Triage] assignees: '' --- diff --git a/.github/ISSUE_TEMPLATE/other_issue.md b/.github/ISSUE_TEMPLATE/other_issue.md new file mode 100644 index 00000000000..9f737b857bc --- /dev/null +++ b/.github/ISSUE_TEMPLATE/other_issue.md @@ -0,0 +1,10 @@ +--- +name: Other issue +about: Open an issue which does not belong to any categories above +title: '' +labels: [Needs-Triage] +assignees: '' + +--- + + diff --git a/DEVGUIDE.md b/DEVGUIDE.md index 2f7d899e329..da02c907c22 100644 --- a/DEVGUIDE.md +++ b/DEVGUIDE.md @@ -44,12 +44,12 @@ This will update your fork with the latest from `dotnet/fsharp` on your machine ## Developing on Windows -Install the latest released [Visual Studio](https://www.visualstudio.com/downloads/), as that is what the `main` branch's tools are synced with. Select the following workloads: +Install the latest released [Visual Studio](https://visualstudio.microsoft.com/vs/preview/) preview, as that is what the `main` branch's tools are synced with. Select the following workloads: * .NET desktop development (also check F# desktop support, as this will install some legacy templates) * Visual Studio extension development -You will also need the latest .NET 6 SDK installed from [here](https://dotnet.microsoft.com/download/dotnet/6.0). +You will also need the latest .NET 7 SDK installed from [here](https://dotnet.microsoft.com/download/dotnet/7.0). Building is simple: @@ -73,10 +73,10 @@ If you don't have everything installed yet, you'll get prompted by Visual Studio If you are just developing the core compiler and library then building ``FSharp.sln`` will be enough. -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: +We recommend installing the latest Visual Studio preview and using that if you are on Windows. However, if you prefer not to do that, you will need to install the following: * [.NET Framework 4.7.2](https://dotnet.microsoft.com/download/dotnet-framework/net472) -* [.NET 6](https://dotnet.microsoft.com/download/dotnet/6.0) +* [.NET 7](https://dotnet.microsoft.com/download/dotnet/7.0) You'll need to pass an additional flag to the build script: diff --git a/README.md b/README.md index 3107814f512..2026df28022 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,11 @@ # The F# compiler, F# core library, and F# editor tools +[![Build Status](https://dev.azure.com/dnceng-public/public/_apis/build/status/dotnet/fsharp/fsharp-ci?branchName=main)](https://dev.azure.com/dnceng-public/public/_build/latest?definitionId=90&branchName=main) +[![Help Wanted](https://img.shields.io/github/issues/dotnet/fsharp/help%20wanted?style=flat-square&color=%232EA043&label=help%20wanted)](https://github.com/dotnet/runtime/labels/help%20wanted) + You're invited to contribute to future releases of the F# compiler, core library, and tools. Development of this repository can be done on any OS supported by [.NET](https://dotnet.microsoft.com/). -You will also need the latest .NET 6 SDK installed from [here](https://dotnet.microsoft.com/download/dotnet/6.0). +You will also need the latest .NET 7 SDK installed from [here](https://dotnet.microsoft.com/download/dotnet/7.0). ## Contributing @@ -54,12 +57,6 @@ After it's finished, open `FSharp.sln` in your editor of choice. Even if you find a single-character typo, we're happy to take the change! Although the codebase can feel daunting for beginners, we and other contributors are happy to help you along. -## Build Status - -| Branch | Status | -|:------:|:------:| -|main|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/fsharp/fsharp-ci?branchName=main)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=496&branchName=main)| - ## Per-build NuGet packages Per-build [versions](https://dev.azure.com/dnceng/public/_packaging?_a=package&feed=dotnet-tools&view=versions&package=FSharp.Compiler.Service&protocolType=NuGet) of our NuGet packages are available via this URL: `https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json` diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 80e7ef74b8e..a129a95dffa 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -8,14 +8,14 @@ - + https://github.com/dotnet/arcade - ba4d2568dd2e3e7538feeaba60215f7bcb99e89c + d2d39276af2db3da7816ee2dc543e120d7e5781e - + https://github.com/dotnet/arcade - ba4d2568dd2e3e7538feeaba60215f7bcb99e89c + d2d39276af2db3da7816ee2dc543e120d7e5781e diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index 5680980fa29..eddb4c380af 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -391,9 +391,9 @@ elif [[ "$__CodeName" == "illumos" ]]; then --with-gnu-ld --disable-nls --disable-libgomp --disable-libquadmath --disable-libssp --disable-libvtv --disable-libcilkrts --disable-libada --disable-libsanitizer \ --disable-libquadmath-support --disable-shared --enable-tls make -j "$JOBS" && make install && cd .. - BaseUrl=https://pkgsrc.joyent.com + BaseUrl=https://pkgsrc.smartos.org if [[ "$__UseMirror" == 1 ]]; then - BaseUrl=http://pkgsrc.smartos.skylime.net + BaseUrl=https://pkgsrc.smartos.skylime.net fi BaseUrl="$BaseUrl/packages/SmartOS/trunk/${__illumosArch}/All" echo "Downloading manifest" @@ -402,7 +402,8 @@ elif [[ "$__CodeName" == "illumos" ]]; then read -ra array <<<"$__IllumosPackages" for package in "${array[@]}"; do echo "Installing '$package'" - package="$(grep ">$package-[0-9]" All | sed -En 's/.*href="(.*)\.tgz".*/\1/p')" + # find last occurrence of package in listing and extract its name + package="$(sed -En '/.*href="('"$package"'-[0-9].*).tgz".*/h;$!d;g;s//\1/p' All)" echo "Resolved name '$package'" wget "$BaseUrl"/"$package".tgz ar -x "$package".tgz diff --git a/eng/common/init-tools-native.ps1 b/eng/common/init-tools-native.ps1 index ac42f04a9d8..fbc67effc36 100644 --- a/eng/common/init-tools-native.ps1 +++ b/eng/common/init-tools-native.ps1 @@ -113,6 +113,7 @@ try { $ToolPath = Convert-Path -Path $BinPath Write-Host "Adding $ToolName to the path ($ToolPath)..." Write-Host "##vso[task.prependpath]$ToolPath" + $env:PATH = "$ToolPath;$env:PATH" $InstalledTools += @{ $ToolName = $ToolDirectory.FullName } } } diff --git a/eng/common/templates/job/execute-sdl.yml b/eng/common/templates/job/execute-sdl.yml index 781a41c9404..65f87b40c66 100644 --- a/eng/common/templates/job/execute-sdl.yml +++ b/eng/common/templates/job/execute-sdl.yml @@ -34,7 +34,7 @@ jobs: - job: Run_SDL dependsOn: ${{ parameters.dependsOn }} displayName: Run SDL tool - condition: eq( ${{ parameters.enable }}, 'true') + condition: and(succeededOrFailed(), eq( ${{ parameters.enable }}, 'true')) variables: - group: DotNet-VSTS-Bot - name: AzDOProjectName diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index 459f3c4fcbb..9f55d3f4666 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -25,6 +25,7 @@ parameters: enablePublishTestResults: false enablePublishUsingPipelines: false disableComponentGovernance: false + componentGovernanceIgnoreDirectories: '' mergeTestResults: false testRunTitle: '' testResultsFormat: '' @@ -146,6 +147,8 @@ jobs: - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), ne(parameters.disableComponentGovernance, 'true')) }}: - task: ComponentGovernanceComponentDetection@0 continueOnError: true + inputs: + ignoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} - ${{ if eq(parameters.enableMicrobuild, 'true') }}: - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: @@ -223,4 +226,5 @@ jobs: parameters: PackageVersion: ${{ parameters.packageVersion}} BuildDropPath: ${{ parameters.buildDropPath }} + IgnoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} diff --git a/eng/common/templates/jobs/source-build.yml b/eng/common/templates/jobs/source-build.yml index 8dd2d355f22..bcd8279944b 100644 --- a/eng/common/templates/jobs/source-build.yml +++ b/eng/common/templates/jobs/source-build.yml @@ -14,7 +14,7 @@ parameters: # This is the default platform provided by Arcade, intended for use by a managed-only repo. defaultManagedPlatform: name: 'Managed' - container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8-20220809204800-17a4aab' + container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8-latest' # Defines the platforms on which to run build jobs. One job is created for each platform, and the # object in this array is sent to the job template as 'platform'. If no platforms are specified, diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 87fcae940cf..258ed2d1108 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -98,7 +98,7 @@ stages: jobs: - job: displayName: NuGet Validation - condition: eq( ${{ parameters.enableNugetValidation }}, 'true') + condition: and(succeededOrFailed(), eq( ${{ parameters.enableNugetValidation }}, 'true')) pool: # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: @@ -282,4 +282,4 @@ stages: -MaestroToken '$(MaestroApiAccessToken)' -WaitPublishingFinish true -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' - -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' \ No newline at end of file + -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' diff --git a/eng/common/templates/steps/generate-sbom.yml b/eng/common/templates/steps/generate-sbom.yml index 4cea8c33187..a06373f38fa 100644 --- a/eng/common/templates/steps/generate-sbom.yml +++ b/eng/common/templates/steps/generate-sbom.yml @@ -2,12 +2,14 @@ # PackageName - The name of the package this SBOM represents. # PackageVersion - The version of the package this SBOM represents. # ManifestDirPath - The path of the directory where the generated manifest files will be placed +# IgnoreDirectories - Directories to ignore for SBOM generation. This will be passed through to the CG component detector. parameters: PackageVersion: 7.0.0 BuildDropPath: '$(Build.SourcesDirectory)/artifacts' PackageName: '.NET' ManifestDirPath: $(Build.ArtifactStagingDirectory)/sbom + IgnoreDirectories: '' sbomContinueOnError: true steps: @@ -34,6 +36,8 @@ steps: BuildDropPath: ${{ parameters.buildDropPath }} PackageVersion: ${{ parameters.packageVersion }} ManifestDirPath: ${{ parameters.manifestDirPath }} + ${{ if ne(parameters.IgnoreDirectories, '') }}: + AdditionalComponentDetectorArgs: '--IgnoreDirectories ${{ parameters.IgnoreDirectories }}' - task: PublishPipelineArtifact@1 displayName: Publish SBOM manifest diff --git a/eng/common/templates/steps/source-build.yml b/eng/common/templates/steps/source-build.yml index 4ec5577d28a..a97a185a367 100644 --- a/eng/common/templates/steps/source-build.yml +++ b/eng/common/templates/steps/source-build.yml @@ -63,6 +63,11 @@ steps: targetRidArgs='/p:TargetRid=${{ parameters.platform.targetRID }}' fi + runtimeOsArgs= + if [ '${{ parameters.platform.runtimeOS }}' != '' ]; then + runtimeOsArgs='/p:RuntimeOS=${{ parameters.platform.runtimeOS }}' + fi + publishArgs= if [ '${{ parameters.platform.skipPublishValidation }}' != 'true' ]; then publishArgs='--publish' @@ -80,6 +85,7 @@ steps: $internalRuntimeDownloadArgs \ $internalRestoreArgs \ $targetRidArgs \ + $runtimeOsArgs \ /p:SourceBuildNonPortable=${{ parameters.platform.nonPortable }} \ /p:ArcadeBuildFromSource=true \ /p:AssetManifestFileName=$assetManifestFileName diff --git a/global.json b/global.json index ed1a0361528..f44a501cf14 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ "perl": "5.32.1.1" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.22473.1", - "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.22473.1" + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.22503.1", + "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.22503.1" } } diff --git a/src/Compiler/Checking/AttributeChecking.fs b/src/Compiler/Checking/AttributeChecking.fs index d1d50393523..de1aadfc803 100644 --- a/src/Compiler/Checking/AttributeChecking.fs +++ b/src/Compiler/Checking/AttributeChecking.fs @@ -412,6 +412,9 @@ let CheckEntityAttributes g (tcref: TyconRef) m = CheckILAttributes g (isByrefLikeTyconRef g m tcref) tcref.ILTyconRawMetadata.CustomAttrs m else CheckFSharpAttributes g tcref.Attribs m + +let CheckILEventAttributes g (tcref: TyconRef) cattrs m = + CheckILAttributes g (isByrefLikeTyconRef g m tcref) cattrs m /// Check the attributes associated with a method, returning warnings and errors as data. let CheckMethInfoAttributes g m tyargsOpt (minfo: MethInfo) = @@ -507,7 +510,8 @@ let CheckUnionCaseAttributes g (x:UnionCaseRef) m = /// Check the attributes on a record field, returning errors and warnings as data. let CheckRecdFieldAttributes g (x:RecdFieldRef) m = CheckEntityAttributes g x.TyconRef m ++ (fun () -> - CheckFSharpAttributes g x.PropertyAttribs m) + CheckFSharpAttributes g x.PropertyAttribs m) ++ (fun () -> + CheckFSharpAttributes g x.RecdField.FieldAttribs m) /// Check the attributes on an F# value, returning errors and warnings as data. let CheckValAttributes g (x:ValRef) m = diff --git a/src/Compiler/Checking/AttributeChecking.fsi b/src/Compiler/Checking/AttributeChecking.fsi index 3236d3bfdbe..622864eff4e 100644 --- a/src/Compiler/Checking/AttributeChecking.fsi +++ b/src/Compiler/Checking/AttributeChecking.fsi @@ -101,3 +101,5 @@ val IsSecurityAttribute: val IsSecurityCriticalAttribute: g: TcGlobals -> Attrib -> bool val IsAssemblyVersionAttribute: g: TcGlobals -> Attrib -> bool + +val CheckILEventAttributes: g: TcGlobals -> tcref: TyconRef -> cattrs: ILAttributes -> m: range -> OperationResult diff --git a/src/Compiler/Checking/CheckDeclarations.fs b/src/Compiler/Checking/CheckDeclarations.fs index 1081998708b..ac0080ca829 100644 --- a/src/Compiler/Checking/CheckDeclarations.fs +++ b/src/Compiler/Checking/CheckDeclarations.fs @@ -545,6 +545,7 @@ module TcRecdUnionAndEnumDeclarations = let TcEnumDecl cenv env parent thisTy fieldTy (SynEnumCase(attributes=Attributes synAttrs; ident= SynIdent(id,_); value=v; xmlDoc=xmldoc; range=m)) = let attrs = TcAttributes cenv env AttributeTargets.Field synAttrs + match v with | SynConst.Bytes _ | SynConst.UInt16s _ diff --git a/src/Compiler/Checking/CheckExpressions.fs b/src/Compiler/Checking/CheckExpressions.fs index 1b65421daba..bd675aba272 100644 --- a/src/Compiler/Checking/CheckExpressions.fs +++ b/src/Compiler/Checking/CheckExpressions.fs @@ -9095,7 +9095,9 @@ and TcEventItemThen (cenv: cenv) overallTy env tpenv mItem mExprAndItem objDetai let (SigOfFunctionForDelegate(delInvokeMeth, delArgTys, _, _)) = GetSigOfFunctionForDelegate cenv.infoReader delTy mItem ad let objArgs = Option.toList (Option.map fst objDetails) MethInfoChecks g cenv.amap true None objArgs env.eAccessRights mItem delInvokeMeth - + + CheckILEventAttributes g einfo.DeclaringTyconRef (einfo.GetCustomAttrs()) mItem |> CommitOperationResult + // This checks for and drops the 'object' sender let argsTy = ArgsTypeOfEventInfo cenv.infoReader mItem ad einfo if not (slotSigHasVoidReturnTy (delInvokeMeth.GetSlotSig(cenv.amap, mItem))) then errorR (nonStandardEventError einfo.EventName mItem) diff --git a/src/Compiler/Checking/CheckPatterns.fs b/src/Compiler/Checking/CheckPatterns.fs index dccff65781b..70382723f92 100644 --- a/src/Compiler/Checking/CheckPatterns.fs +++ b/src/Compiler/Checking/CheckPatterns.fs @@ -289,6 +289,11 @@ and TcPat warnOnUpper (cenv: cenv) env valReprInfo vFlags (patEnv: TcPatLinearEn | SynPat.Or (pat1, pat2, m, _) -> TcPatOr warnOnUpper cenv env vFlags patEnv ty pat1 pat2 m + | SynPat.ListCons(pat1, pat2, m, trivia) -> + let longDotId = SynLongIdent((mkSynCaseName trivia.ColonColonRange opNameCons), [], [Some (FSharp.Compiler.SyntaxTrivia.IdentTrivia.OriginalNotation "::")]) + let args = SynArgPats.Pats [ SynPat.Tuple(false, [ pat1; pat2 ], m) ] + TcPatLongIdent warnOnUpper cenv env ad valReprInfo vFlags patEnv ty (longDotId, None, args, None, m) + | SynPat.Ands (pats, m) -> TcPatAnds warnOnUpper cenv env vFlags patEnv ty pats m @@ -471,13 +476,13 @@ and TcNullPat cenv env patEnv ty m = and CheckNoArgsForLiteral args m = match args with | SynArgPats.Pats [] - | SynArgPats.NamePatPairs ([], _) -> () + | SynArgPats.NamePatPairs (pats = []) -> () | _ -> errorR (Error (FSComp.SR.tcLiteralDoesNotTakeArguments (), m)) and GetSynArgPatterns args = match args with | SynArgPats.Pats args -> args - | SynArgPats.NamePatPairs (pairs, _) -> List.map (fun (_, _, pat) -> pat) pairs + | SynArgPats.NamePatPairs (pats = pairs) -> List.map (fun (_, _, pat) -> pat) pairs and TcArgPats warnOnUpper (cenv: cenv) env vFlags patEnv args = let g = cenv.g @@ -565,7 +570,7 @@ and ApplyUnionCaseOrExn m (cenv: cenv) env overallTy item = UnifyTypes cenv env m overallTy g.exn_ty CheckTyconAccessible cenv.amap m ad ecref |> ignore let mkf mArgs args = TPat_exnconstr(ecref, args, unionRanges m mArgs) - mkf, recdFieldTysOfExnDefRef ecref, [ for f in (recdFieldsOfExnDefRef ecref) -> f.Id ] + mkf, recdFieldTysOfExnDefRef ecref, [ for f in (recdFieldsOfExnDefRef ecref) -> f ] | Item.UnionCase(ucinfo, showDeprecated) -> if showDeprecated then @@ -582,7 +587,7 @@ and ApplyUnionCaseOrExn m (cenv: cenv) env overallTy item = let inst = mkTyparInst ucref.TyconRef.TyparsNoRange ucinfo.TypeInst UnifyTypes cenv env m overallTy resTy let mkf mArgs args = TPat_unioncase(ucref, ucinfo.TypeInst, args, unionRanges m mArgs) - mkf, actualTysOfUnionCaseFields inst ucref, [ for f in ucref.AllFieldsAsList -> f.Id ] + mkf, actualTysOfUnionCaseFields inst ucref, [ for f in ucref.AllFieldsAsList -> f] | _ -> invalidArg "item" "not a union case or exception reference" @@ -600,7 +605,7 @@ and TcPatLongIdentUnionCaseOrExnCase warnOnUpper cenv env ad vFlags patEnv ty (m let args, extraPatternsFromNames = match args with | SynArgPats.Pats args -> args, [] - | SynArgPats.NamePatPairs (pairs, m) -> + | SynArgPats.NamePatPairs (pairs, m, _) -> // rewrite patterns from the form (name-N = pat-N; ...) to (..._, pat-N, _...) // so type T = Case of name: int * value: int // | Case(value = v) @@ -610,7 +615,7 @@ and TcPatLongIdentUnionCaseOrExnCase warnOnUpper cenv env ad vFlags patEnv ty (m let extraPatterns = List () for id, _, pat in pairs do - match argNames |> List.tryFindIndex (fun id2 -> id.idText = id2.idText) with + match argNames |> List.tryFindIndex (fun id2 -> id.idText = id2.Id.idText) with | None -> extraPatterns.Add pat match item with @@ -678,7 +683,14 @@ and TcPatLongIdentUnionCaseOrExnCase warnOnUpper cenv env ad vFlags patEnv ty (m elif numArgs < numArgTys then if numArgTys > 1 then // Expects tuple without enough args - errorR (Error (FSComp.SR.tcUnionCaseExpectsTupledArguments numArgTys, m)) + let printTy = NicePrint.minimalStringOfType env.DisplayEnv + let missingArgs = + argNames.[numArgs..numArgTys - 1] + |> List.map (fun id -> (if id.rfield_name_generated then "" else id.DisplayName + ": ") + printTy id.FormalType) + |> String.concat (Environment.NewLine + "\t") + |> fun s -> Environment.NewLine + "\t" + s + + errorR (Error (FSComp.SR.tcUnionCaseExpectsTupledArguments(numArgTys, numArgs, missingArgs), m)) else errorR (UnionCaseWrongArguments (env.DisplayEnv, numArgTys, numArgs, m)) args @ (List.init (numArgTys - numArgs) (fun _ -> SynPat.Wild (m.MakeSynthetic()))), extraPatterns diff --git a/src/Compiler/Checking/PatternMatchCompilation.fs b/src/Compiler/Checking/PatternMatchCompilation.fs index 0b0a5e0624f..2c53c73202e 100644 --- a/src/Compiler/Checking/PatternMatchCompilation.fs +++ b/src/Compiler/Checking/PatternMatchCompilation.fs @@ -143,7 +143,6 @@ let GetSubExprOfInput g (gtps, tyargs, tinst) (SubExpr(accessf, (ve2, v2))) = // The ints record which choices taken, e.g. tuple/record fields. type Path = | PathQuery of Path * Unique - | PathConj of Path * int | PathTuple of Path * TypeInst * int | PathRecd of Path * TyconRef * TypeInst * int | PathUnionConstr of Path * UnionCaseRef * TypeInst * int @@ -154,7 +153,6 @@ type Path = let rec pathEq p1 p2 = match p1, p2 with | PathQuery(p1, n1), PathQuery(p2, n2) -> (n1 = n2) && pathEq p1 p2 - | PathConj(p1, n1), PathConj(p2, n2) -> (n1 = n2) && pathEq p1 p2 | PathTuple(p1, _, n1), PathTuple(p2, _, n2) -> (n1 = n2) && pathEq p1 p2 | PathRecd(p1, _, _, n1), PathRecd(p2, _, _, n2) -> (n1 = n2) && pathEq p1 p2 | PathUnionConstr(p1, _, _, n1), PathUnionConstr(p2, _, _, n2) -> (n1 = n2) && pathEq p1 p2 @@ -203,8 +201,6 @@ let RefuteDiscrimSet g m path discrims = let rec go path tm = match path with | PathQuery _ -> raise CannotRefute - | PathConj (p, _j) -> - go p tm | PathTuple (p, tys, j) -> let k, eCoversVals = mkOneKnown tm j tys go p (fun _ -> mkRefTupled g m k tys, eCoversVals) @@ -391,8 +387,6 @@ type Frontier = Frontier of ClauseNumber * Actives * ValMap type InvestigationPoint = Investigation of ClauseNumber * DecisionTreeTest * Path // Note: actives must be a SortedDictionary -// REVIEW: improve these data structures, though surprisingly these functions don't tend to show up -// on profiling runs let rec isMemOfActives p1 actives = match actives with | [] -> false @@ -1624,7 +1618,7 @@ let CompilePatternBasic subPats |> List.collect (fun subPat -> BindProjectionPattern (Active(inpPath, inpExpr, subPat)) activeState) | TPat_conjs(subPats, _m) -> - let newActives = List.mapi (mkSubActive (fun path j -> PathConj(path, j)) (fun _j -> inpAccess)) subPats + let newActives = List.mapi (mkSubActive (fun path _j -> path) (fun _j -> inpAccess)) subPats BindProjectionPatterns newActives activeState | TPat_range (c1, c2, m) -> diff --git a/src/Compiler/Checking/infos.fs b/src/Compiler/Checking/infos.fs index 1c0612eb611..68e844fa919 100644 --- a/src/Compiler/Checking/infos.fs +++ b/src/Compiler/Checking/infos.fs @@ -438,6 +438,11 @@ type ILTypeInfo = member x.IsValueType = x.RawMetadata.IsStructOrEnum + /// Indicates if the type is marked with the [] attribute. + member x.IsReadOnly (g: TcGlobals) = + x.RawMetadata.CustomAttrs + |> TryFindILAttribute g.attrib_IsReadOnlyAttribute + member x.Instantiate inst = let (ILTypeInfo(g, ty, tref, tdef)) = x ILTypeInfo(g, instType inst ty, tref, tdef) @@ -993,15 +998,22 @@ type MethInfo = member x.IsStruct = isStructTy x.TcGlobals x.ApparentEnclosingType - /// Indicates if this method is read-only; usually by the [] attribute. + member x.IsOnReadOnlyType = + let g = x.TcGlobals + let typeInfo = ILTypeInfo.FromType g x.ApparentEnclosingType + typeInfo.IsReadOnly g + + /// Indicates if this method is read-only; usually by the [] attribute on method or struct level. /// Must be an instance method. /// Receiver must be a struct type. member x.IsReadOnly = - // Perf Review: Is there a way we can cache this result? + // Perf Review: Is there a way we can cache this result? + x.IsInstance && x.IsStruct && match x with - | ILMeth (g, ilMethInfo, _) -> ilMethInfo.IsReadOnly g + | ILMeth (g, ilMethInfo, _) -> + ilMethInfo.IsReadOnly g || x.IsOnReadOnlyType | FSMeth _ -> false // F# defined methods not supported yet. Must be a language feature. | _ -> false @@ -2263,6 +2275,12 @@ type EventInfo = | ProvidedEvent (_, ei, _) -> ProvidedEventInfo.TaintedGetHashCode ei #endif override x.ToString() = "event " + x.EventName + + /// Get custom attributes for events (only applicable for IL events) + member x.GetCustomAttrs() = + match x with + | ILEvent(ILEventInfo(_, ilEventDef))-> ilEventDef.CustomAttrs + | _ -> ILAttributes.Empty //------------------------------------------------------------------------- // Helpers associated with getting and comparing method signatures diff --git a/src/Compiler/Checking/infos.fsi b/src/Compiler/Checking/infos.fsi index 63a24eb6502..550c7860b34 100644 --- a/src/Compiler/Checking/infos.fsi +++ b/src/Compiler/Checking/infos.fsi @@ -1009,6 +1009,9 @@ type EventInfo = /// Get the delegate type associated with the event. member GetDelegateType: amap: ImportMap * m: range -> TType + /// Get custom attributes for events (only applicable for IL events) + member GetCustomAttrs: unit -> ILAttributes + /// An exception type used to raise an error using the old error system. /// /// Error text: "A definition to be compiled as a .NET event does not have the expected form. Only property members can be compiled as .NET events." diff --git a/src/Compiler/Driver/CompilerConfig.fs b/src/Compiler/Driver/CompilerConfig.fs index 08946b84f63..91a2e9fde3d 100644 --- a/src/Compiler/Driver/CompilerConfig.fs +++ b/src/Compiler/Driver/CompilerConfig.fs @@ -1405,14 +1405,13 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = /// 'framework' reference set that is potentially shared across multiple compilations. member tcConfig.IsSystemAssembly(fileName: string) = try + let dirName = Path.GetDirectoryName fileName + let baseName = FileSystemUtils.fileNameWithoutExtension fileName + FileSystem.FileExistsShim fileName - && ((tcConfig.GetTargetFrameworkDirectories() - |> List.exists (fun clrRoot -> clrRoot = Path.GetDirectoryName fileName)) - || (tcConfig - .FxResolver - .GetSystemAssemblies() - .Contains(FileSystemUtils.fileNameWithoutExtension fileName)) - || tcConfig.FxResolver.IsInReferenceAssemblyPackDirectory fileName) + && ((tcConfig.GetTargetFrameworkDirectories() |> List.contains dirName) + || FxResolver.GetSystemAssemblies().Contains baseName + || FxResolver.IsReferenceAssemblyPackDirectoryApprox dirName) with _ -> false diff --git a/src/Compiler/Driver/FxResolver.fs b/src/Compiler/Driver/FxResolver.fs index ae69346d689..a9ddac4a7ad 100644 --- a/src/Compiler/Driver/FxResolver.fs +++ b/src/Compiler/Driver/FxResolver.fs @@ -629,7 +629,7 @@ type internal FxResolver // A set of assemblies to always consider to be system assemblies. A common set of these can be used a shared // resources between projects in the compiler services. Also all assemblies where well-known system types exist // referenced from TcGlobals must be listed here. - let systemAssemblies = + static let systemAssemblies = HashSet [ // NOTE: duplicates are ok in this list @@ -807,17 +807,10 @@ type internal FxResolver "WindowsBase" ] - member _.GetSystemAssemblies() = systemAssemblies + static member GetSystemAssemblies() = systemAssemblies - member _.IsInReferenceAssemblyPackDirectory fileName = - fxlock.AcquireLock(fun fxtok -> - RequireFxResolverLock(fxtok, "assuming all member require lock") - - match tryGetNetCoreRefsPackDirectoryRoot () |> replayWarnings with - | _, Some root -> - let path = Path.GetDirectoryName(fileName) - path.StartsWith(root, StringComparison.OrdinalIgnoreCase) - | _ -> false) + static member IsReferenceAssemblyPackDirectoryApprox(dirName: string) = + dirName.Contains "Microsoft.NETCore.App.Ref" member _.TryGetSdkDir() = fxlock.AcquireLock(fun fxtok -> diff --git a/src/Compiler/Driver/FxResolver.fsi b/src/Compiler/Driver/FxResolver.fsi index 2bca0a75d8c..d740d2fc497 100644 --- a/src/Compiler/Driver/FxResolver.fsi +++ b/src/Compiler/Driver/FxResolver.fsi @@ -28,12 +28,14 @@ type internal FxResolver = member GetFrameworkRefsPackDirectory: unit -> string option - member GetSystemAssemblies: unit -> HashSet + static member GetSystemAssemblies: unit -> HashSet /// Gets the selected target framework moniker, e.g netcore3.0, net472, and the running rid of the current machine member GetTfmAndRid: unit -> string * string - member IsInReferenceAssemblyPackDirectory: fileName: string -> bool + /// Determines if an assembly is in the core set of assemblies with high likelihood of + /// being shared amongst a set of common scripting references + static member IsReferenceAssemblyPackDirectoryApprox: dirName: string -> bool member TryGetDesiredDotNetSdkVersionForDirectory: unit -> Result diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index 086d5279488..48b39055581 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -572,7 +572,7 @@ tcCouldNotFindIDisposable,"Couldn't find Dispose on IDisposable, or it was overl 724,tcInvalidIndexIntoActivePatternArray,"Internal error. Invalid index into active pattern array" 725,tcUnionCaseDoesNotTakeArguments,"This union case does not take arguments" 726,tcUnionCaseRequiresOneArgument,"This union case takes one argument" -727,tcUnionCaseExpectsTupledArguments,"This union case expects %d arguments in tupled form" +727,tcUnionCaseExpectsTupledArguments,"This union case expects %d arguments in tupled form, but was given %d. The missing field arguments may be any of:%s" 728,tcFieldIsNotStatic,"Field '%s' is not static" 729,tcFieldNotLiteralCannotBeUsedInPattern,"This field is not a literal and cannot be used in a pattern" 730,tcRequireVarConstRecogOrLiteral,"This is not a variable, constant, active recognizer or literal" @@ -1653,3 +1653,5 @@ reprStateMachineInvalidForm,"The state machine has an unexpected form" 3536,tcUsingInterfaceWithStaticAbstractMethodAsType,"'%s' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'." 3537,tcTraitHasMultipleSupportTypes,"The trait '%s' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance." 3545,tcMissingRequiredMembers,"The following required properties have to be initalized:%s" +3546,parsExpectingPatternInTuple,"Expecting pattern" +3547,parsExpectedPatternAfterToken,"Expected a pattern after this point" diff --git a/src/Compiler/Service/FSharpCheckerResults.fs b/src/Compiler/Service/FSharpCheckerResults.fs index 2abbb49b4d2..70647f70d59 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fs +++ b/src/Compiler/Service/FSharpCheckerResults.fs @@ -2652,9 +2652,9 @@ type FSharpCheckFileResults ToolTipText.ToolTipText [ for kw in names do - match Tokenization.FSharpKeywords.KeywordsDescriptionLookup.TryGetValue kw with - | false, _ -> () - | true, kwDescription -> + match Tokenization.FSharpKeywords.KeywordsDescriptionLookup kw with + | None -> () + | Some kwDescription -> let kwText = kw |> TaggedText.tagKeyword |> wordL |> LayoutRender.toArray let kwTip = ToolTipElementData.Create(kwText, FSharpXmlDoc.None) diff --git a/src/Compiler/Service/ServiceDeclarationLists.fs b/src/Compiler/Service/ServiceDeclarationLists.fs index 17f8b27213d..399a3037eac 100644 --- a/src/Compiler/Service/ServiceDeclarationLists.fs +++ b/src/Compiler/Service/ServiceDeclarationLists.fs @@ -39,7 +39,7 @@ type ToolTipElementData = Remarks: TaggedText[] option ParamName : string option } - static member Create(layout, xml, ?typeMapping, ?paramName, ?remarks) = + static member internal Create(layout, xml, ?typeMapping, ?paramName, ?remarks) = { MainDescription=layout; XmlDoc=xml; TypeMapping=defaultArg typeMapping []; ParamName=paramName; Remarks=remarks } /// A single data tip display element diff --git a/src/Compiler/Service/ServiceDeclarationLists.fsi b/src/Compiler/Service/ServiceDeclarationLists.fsi index b67f53da34b..5bb8dcd9173 100644 --- a/src/Compiler/Service/ServiceDeclarationLists.fsi +++ b/src/Compiler/Service/ServiceDeclarationLists.fsi @@ -31,7 +31,7 @@ type public ToolTipElementData = ParamName: string option } - static member Create: layout: TaggedText[] * xml: FSharpXmlDoc * ?typeMapping: TaggedText[] list * ?paramName: string * ?remarks: TaggedText[] -> ToolTipElementData + static member internal Create: layout: TaggedText[] * xml: FSharpXmlDoc * ?typeMapping: TaggedText[] list * ?paramName: string * ?remarks: TaggedText[] -> ToolTipElementData /// A single tool tip display element // diff --git a/src/Compiler/Service/ServiceLexing.fs b/src/Compiler/Service/ServiceLexing.fs index 6ee75eab602..80cfb38cc6c 100644 --- a/src/Compiler/Service/ServiceLexing.fs +++ b/src/Compiler/Service/ServiceLexing.fs @@ -1216,7 +1216,13 @@ module FSharpKeywords = let KeywordsWithDescription = PrettyNaming.keywordsWithDescription - let KeywordsDescriptionLookup = KeywordsWithDescription |> dict + let internal KeywordsDescriptionLookup = + let d = KeywordsWithDescription |> dict + + fun kw -> + match d.TryGetValue kw with + | false, _ -> None + | true, desc -> Some desc let KeywordNames = Lexhelp.Keywords.keywordNames diff --git a/src/Compiler/Service/ServiceLexing.fsi b/src/Compiler/Service/ServiceLexing.fsi index a53bba2669f..39b2febf315 100755 --- a/src/Compiler/Service/ServiceLexing.fsi +++ b/src/Compiler/Service/ServiceLexing.fsi @@ -345,7 +345,7 @@ module FSharpKeywords = val KeywordsWithDescription: (string * string) list /// A lookup from keywords to their descriptions - val KeywordsDescriptionLookup: System.Collections.Generic.IDictionary + val internal KeywordsDescriptionLookup: (string -> string option) /// All the keywords in the F# language val KeywordNames: string list diff --git a/src/Compiler/Service/ServiceParseTreeWalk.fs b/src/Compiler/Service/ServiceParseTreeWalk.fs index 08c89d969f9..f3443fd95ff 100755 --- a/src/Compiler/Service/ServiceParseTreeWalk.fs +++ b/src/Compiler/Service/ServiceParseTreeWalk.fs @@ -789,7 +789,8 @@ module SyntaxTraversal = match p with | SynPat.Paren (p, _) -> traversePat path p | SynPat.As (p1, p2, _) - | SynPat.Or (p1, p2, _, _) -> [ p1; p2 ] |> List.tryPick (traversePat path) + | SynPat.Or (p1, p2, _, _) + | SynPat.ListCons (p1, p2, _, _) -> [ p1; p2 ] |> List.tryPick (traversePat path) | SynPat.Ands (ps, _) | SynPat.Tuple (_, ps, _) | SynPat.ArrayOrList (_, ps, _) -> ps |> List.tryPick (traversePat path) @@ -797,7 +798,7 @@ module SyntaxTraversal = | SynPat.LongIdent (argPats = args) -> match args with | SynArgPats.Pats ps -> ps |> List.tryPick (traversePat path) - | SynArgPats.NamePatPairs (ps, _) -> ps |> List.map (fun (_, _, pat) -> pat) |> List.tryPick (traversePat path) + | SynArgPats.NamePatPairs (pats = ps) -> ps |> List.map (fun (_, _, pat) -> pat) |> List.tryPick (traversePat path) | SynPat.Typed (p, ty, _) -> match traversePat path p with | None -> traverseSynType path ty diff --git a/src/Compiler/Service/ServiceParsedInputOps.fs b/src/Compiler/Service/ServiceParsedInputOps.fs index 6b6a1c906f0..7d3c916bc8e 100644 --- a/src/Compiler/Service/ServiceParsedInputOps.fs +++ b/src/Compiler/Service/ServiceParsedInputOps.fs @@ -556,7 +556,7 @@ module ParsedInput = let (|ConstructorPats|) pats = match pats with | SynArgPats.Pats ps -> ps - | SynArgPats.NamePatPairs (xs, _) -> List.map (fun (_, _, pat) -> pat) xs + | SynArgPats.NamePatPairs (pats = xs) -> List.map (fun (_, _, pat) -> pat) xs /// A recursive pattern that collect all sequential expressions to avoid StackOverflowException let rec (|Sequentials|_|) expr = @@ -581,7 +581,7 @@ module ParsedInput = |> Option.orElseWith (fun () -> ifPosInRange r (fun _ -> List.tryPick (walkSynModuleDecl isTopLevel) decls)) and walkAttribute (attr: SynAttribute) = - if isPosInRange attr.Range then + if isPosInRange attr.TypeName.Range then Some EntityKind.Attribute else None @@ -619,7 +619,8 @@ module ParsedInput = | SynPat.As (pat1, pat2, _) -> List.tryPick walkPat [ pat1; pat2 ] | SynPat.Typed (pat, t, _) -> walkPat pat |> Option.orElseWith (fun () -> walkType t) | SynPat.Attrib (pat, Attributes attrs, _) -> walkPat pat |> Option.orElseWith (fun () -> List.tryPick walkAttribute attrs) - | SynPat.Or (pat1, pat2, _, _) -> List.tryPick walkPat [ pat1; pat2 ] + | SynPat.Or (pat1, pat2, _, _) + | SynPat.ListCons (pat1, pat2, _, _) -> List.tryPick walkPat [ pat1; pat2 ] | SynPat.LongIdent (typarDecls = typars; argPats = ConstructorPats pats; range = r) -> ifPosInRange r (fun _ -> kind) |> Option.orElseWith (fun () -> @@ -1566,7 +1567,7 @@ module ParsedInput = let (|ConstructorPats|) pats = match pats with | SynArgPats.Pats ps -> ps - | SynArgPats.NamePatPairs (xs, _) -> List.map (fun (_, _, pat) -> pat) xs + | SynArgPats.NamePatPairs (pats = xs) -> List.map (fun (_, _, pat) -> pat) xs /// Returns all `Ident`s and `LongIdent`s found in an untyped AST. let getLongIdents (parsedInput: ParsedInput) : IDictionary = @@ -1638,7 +1639,8 @@ module ParsedInput = walkPat pat List.iter walkAttribute attrs | SynPat.As (pat1, pat2, _) - | SynPat.Or (pat1, pat2, _, _) -> List.iter walkPat [ pat1; pat2 ] + | SynPat.Or (pat1, pat2, _, _) + | SynPat.ListCons (pat1, pat2, _, _) -> List.iter walkPat [ pat1; pat2 ] | SynPat.LongIdent (longDotId = ident; typarDecls = typars; argPats = ConstructorPats pats) -> addLongIdentWithDots ident diff --git a/src/Compiler/Service/ServiceXmlDocParser.fs b/src/Compiler/Service/ServiceXmlDocParser.fs index ae9217e8a02..4a7eca7868d 100644 --- a/src/Compiler/Service/ServiceXmlDocParser.fs +++ b/src/Compiler/Service/ServiceXmlDocParser.fs @@ -25,6 +25,7 @@ module XmlDocParsing = | SynPat.Typed (pat, _type, _range) -> digNamesFrom pat | SynPat.Attrib (pat, _attrs, _range) -> digNamesFrom pat | SynPat.LongIdent(argPats = ConstructorPats pats) -> pats |> List.collect digNamesFrom + | SynPat.ListCons (p1, p2, _, _) -> List.collect digNamesFrom [ p1; p2 ] | SynPat.Tuple (_, pats, _range) -> pats |> List.collect digNamesFrom | SynPat.Paren (pat, _range) -> digNamesFrom pat | SynPat.OptionalVal (id, _) -> [ id.idText ] diff --git a/src/Compiler/Symbols/Symbols.fs b/src/Compiler/Symbols/Symbols.fs index ec343ad2a8d..9adb5ffb1f9 100644 --- a/src/Compiler/Symbols/Symbols.fs +++ b/src/Compiler/Symbols/Symbols.fs @@ -266,7 +266,10 @@ type FSharpSymbol(cenv: SymbolEnv, item: unit -> Item, access: FSharpSymbol -> C static member Create(cenv, item): FSharpSymbol = let dflt() = FSharpSymbol(cenv, (fun () -> item), (fun _ _ _ -> true)) - match item with + match item with + | Item.Value v when v.Deref.IsClassConstructor -> + FSharpMemberOrFunctionOrValue(cenv, C (FSMeth(cenv.g, generalizeTyconRef cenv.g v.DeclaringEntity |> snd, v, None)), item) :> _ + | Item.Value v -> FSharpMemberOrFunctionOrValue(cenv, V v, item) :> _ | Item.UnionCase (uinfo, _) -> FSharpUnionCase(cenv, uinfo.UnionCaseRef) :> _ | Item.ExnCase tcref -> FSharpEntity(cenv, tcref) :>_ @@ -632,8 +635,10 @@ type FSharpEntity(cenv: SymbolEnv, entity: EntityRef) = protect <| fun () -> ([ let entityTy = generalizedTyconRef cenv.g entity let createMember (minfo: MethInfo) = - if minfo.IsConstructor then FSharpMemberOrFunctionOrValue(cenv, C minfo, Item.CtorGroup (minfo.DisplayName, [minfo])) - else FSharpMemberOrFunctionOrValue(cenv, M minfo, Item.MethodGroup (minfo.DisplayName, [minfo], None)) + if minfo.IsConstructor || minfo.IsClassConstructor then + FSharpMemberOrFunctionOrValue(cenv, C minfo, Item.CtorGroup (minfo.DisplayName, [minfo])) + else + FSharpMemberOrFunctionOrValue(cenv, M minfo, Item.MethodGroup (minfo.DisplayName, [minfo], None)) if x.IsFSharpAbbreviation then () elif x.IsFSharp then diff --git a/src/Compiler/SyntaxTree/ParseHelpers.fs b/src/Compiler/SyntaxTree/ParseHelpers.fs index f3e3fcdfdaf..6aa973d275e 100644 --- a/src/Compiler/SyntaxTree/ParseHelpers.fs +++ b/src/Compiler/SyntaxTree/ParseHelpers.fs @@ -468,6 +468,7 @@ let mkSynMemberDefnGetSet { LetKeyword = None EqualsRange = mEquals + ExternKeyword = None } let binding = @@ -542,6 +543,7 @@ let mkSynMemberDefnGetSet { LetKeyword = None EqualsRange = mEquals + ExternKeyword = None } let binding = @@ -629,6 +631,7 @@ let mkSynMemberDefnGetSet { LetKeyword = None EqualsRange = mEquals + ExternKeyword = None } let bindingOuter = diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fs b/src/Compiler/SyntaxTree/SyntaxTree.fs index 1845f463540..9412e8486ae 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fs +++ b/src/Compiler/SyntaxTree/SyntaxTree.fs @@ -886,12 +886,12 @@ type SynSimplePats = type SynArgPats = | Pats of pats: SynPat list - | NamePatPairs of pats: (Ident * range * SynPat) list * range: range + | NamePatPairs of pats: (Ident * range * SynPat) list * range: range * trivia: SynArgPatsNamePatPairsTrivia member x.Patterns = match x with | Pats pats -> pats - | NamePatPairs (pats, _) -> pats |> List.map (fun (_, _, pat) -> pat) + | NamePatPairs (pats = pats) -> pats |> List.map (fun (_, _, pat) -> pat) [] type SynPat = @@ -908,6 +908,8 @@ type SynPat = | Or of lhsPat: SynPat * rhsPat: SynPat * range: range * trivia: SynPatOrTrivia + | ListCons of lhsPat: SynPat * rhsPat: SynPat * range: range * trivia: SynPatListConsTrivia + | Ands of pats: SynPat list * range: range | As of lhsPat: SynPat * rhsPat: SynPat * range: range @@ -953,6 +955,7 @@ type SynPat = | SynPat.Wild (range = m) | SynPat.Named (range = m) | SynPat.Or (range = m) + | SynPat.ListCons (range = m) | SynPat.Ands (range = m) | SynPat.As (range = m) | SynPat.LongIdent (range = m) diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fsi b/src/Compiler/SyntaxTree/SyntaxTree.fsi index b1538eaa489..1dfd44d2c0f 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTree.fsi @@ -1024,7 +1024,7 @@ type SynSimplePats = type SynArgPats = | Pats of pats: SynPat list - | NamePatPairs of pats: (Ident * range * SynPat) list * range: range + | NamePatPairs of pats: (Ident * range * SynPat) list * range: range * trivia: SynArgPatsNamePatPairsTrivia member Patterns: SynPat list @@ -1050,6 +1050,9 @@ type SynPat = /// A disjunctive pattern 'pat1 | pat2' | Or of lhsPat: SynPat * rhsPat: SynPat * range: range * trivia: SynPatOrTrivia + /// A conjunctive pattern 'pat1 :: pat2' + | ListCons of lhsPat: SynPat * rhsPat: SynPat * range: range * trivia: SynPatListConsTrivia + /// A conjunctive pattern 'pat1 & pat2' | Ands of pats: SynPat list * range: range diff --git a/src/Compiler/SyntaxTree/SyntaxTreeOps.fs b/src/Compiler/SyntaxTree/SyntaxTreeOps.fs index ef3673fa44f..aefc238d10e 100644 --- a/src/Compiler/SyntaxTree/SyntaxTreeOps.fs +++ b/src/Compiler/SyntaxTree/SyntaxTreeOps.fs @@ -1031,6 +1031,13 @@ let rec normalizeTupleExpr exprs commas : SynExpr list * range list = innerExprs @ rest, innerCommas @ commas | _ -> exprs, commas +let rec normalizeTuplePat pats : SynPat list = + match pats with + | SynPat.Tuple (false, innerPats, _) :: rest -> + let innerExprs = normalizeTuplePat (List.rev innerPats) + innerExprs @ rest + | _ -> pats + /// Remove all members that were captures as SynMemberDefn.GetSetMember let rec desugarGetSetMembers (memberDefns: SynMemberDefns) = memberDefns diff --git a/src/Compiler/SyntaxTree/SyntaxTreeOps.fsi b/src/Compiler/SyntaxTree/SyntaxTreeOps.fsi index 5af8180d05e..b78563d4bce 100644 --- a/src/Compiler/SyntaxTree/SyntaxTreeOps.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTreeOps.fsi @@ -350,6 +350,8 @@ val mkDynamicArgExpr: expr: SynExpr -> SynExpr val normalizeTupleExpr: exprs: SynExpr list -> commas: range list -> SynExpr list * range List +val normalizeTuplePat: pats: SynPat list -> SynPat list + val desugarGetSetMembers: memberDefns: SynMemberDefns -> SynMemberDefns val getTypeFromTuplePath: path: SynTupleTypeSegment list -> SynType list diff --git a/src/Compiler/SyntaxTree/SyntaxTrivia.fs b/src/Compiler/SyntaxTree/SyntaxTrivia.fs index 1b03d20b615..fa4ebc784c8 100644 --- a/src/Compiler/SyntaxTree/SyntaxTrivia.fs +++ b/src/Compiler/SyntaxTree/SyntaxTrivia.fs @@ -122,6 +122,9 @@ type SynUnionCaseTrivia = { BarRange: range option } [] type SynPatOrTrivia = { BarRange: range } +[] +type SynPatListConsTrivia = { ColonColonRange: range } + [] type SynTypeDefnTrivia = { @@ -156,12 +159,14 @@ type SynTypeDefnSigTrivia = type SynBindingTrivia = { LetKeyword: range option + ExternKeyword: range option EqualsRange: range option } static member Zero: SynBindingTrivia = { LetKeyword = None + ExternKeyword = None EqualsRange = None } @@ -257,3 +262,6 @@ type SynMemberGetSetTrivia = AndKeyword: range option SetKeyword: range option } + +[] +type SynArgPatsNamePatPairsTrivia = { ParenRange: range } diff --git a/src/Compiler/SyntaxTree/SyntaxTrivia.fsi b/src/Compiler/SyntaxTree/SyntaxTrivia.fsi index fbdf8ecf30e..b6f0532d73c 100644 --- a/src/Compiler/SyntaxTree/SyntaxTrivia.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTrivia.fsi @@ -199,6 +199,14 @@ type SynPatOrTrivia = BarRange: range } +/// Represents additional information for SynPat.Cons +[] +type SynPatListConsTrivia = + { + /// The syntax range of the `::` token. + ColonColonRange: range + } + /// Represents additional information for SynTypeDefn [] type SynTypeDefnTrivia = @@ -238,6 +246,9 @@ type SynBindingTrivia = /// The syntax range of the `let` keyword. LetKeyword: range option + /// The syntax range of the `extern` keyword. + ExternKeyword: range option + /// The syntax range of the `=` token. EqualsRange: range option } @@ -365,3 +376,11 @@ type SynMemberGetSetTrivia = /// The syntax range of the `set` keyword SetKeyword: range option } + +/// Represents additional information for SynArgPats.NamePatPairs +[] +type SynArgPatsNamePatPairsTrivia = + { + /// The syntax range from the beginning of the `(` token till the end of the `)` token. + ParenRange: range + } diff --git a/src/Compiler/TypedTree/TypedTree.fs b/src/Compiler/TypedTree/TypedTree.fs index b3fcdd6c7d5..dfdc9640a0c 100644 --- a/src/Compiler/TypedTree/TypedTree.fs +++ b/src/Compiler/TypedTree/TypedTree.fs @@ -4156,7 +4156,7 @@ type TType = (match anonInfo.TupInfo with | TupInfo.Const false -> "" | TupInfo.Const true -> "struct ") - + "{|" + String.concat "," (Seq.map2 (fun nm ty -> nm + " " + string ty + ";") anonInfo.SortedNames tinst) + ")" + "|}" + + "{|" + String.concat "," (Seq.map2 (fun nm ty -> nm + " " + string ty + ";") anonInfo.SortedNames tinst) + "|}" | TType_fun (domainTy, retTy, _) -> "(" + string domainTy + " -> " + string retTy + ")" | TType_ucase (uc, tinst) -> "ucase " + uc.CaseName + (match tinst with [] -> "" | tys -> "<" + String.concat "," (List.map string tys) + ">") | TType_var (tp, _) -> diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index d7bbdaaf68e..b732754d7fc 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -1561,18 +1561,23 @@ attributeListElements: attribute: /* A custom attribute */ | path opt_HIGH_PRECEDENCE_APP opt_atomicExprAfterType - { let arg = match $3 with None -> mkSynUnit $1.Range | Some e -> e - ({ TypeName=$1; ArgExpr=arg; Target=None; AppliesToGetterAndSetter=false; Range=$1.Range } : SynAttribute) } + { let arg = match $3 with None -> mkSynUnit $1.Range | Some e -> e + let m = unionRanges $1.Range arg.Range + ({ TypeName=$1; ArgExpr=arg; Target=None; AppliesToGetterAndSetter=false; Range=m } : SynAttribute) } /* A custom attribute with an attribute target */ | attributeTarget path opt_HIGH_PRECEDENCE_APP opt_atomicExprAfterType - { let arg = match $4 with None -> mkSynUnit $2.Range | Some e -> e - ({ TypeName=$2; ArgExpr=arg; Target=$1; AppliesToGetterAndSetter=false; Range=$2.Range } : SynAttribute) } + { let arg = match $4 with None -> mkSynUnit $2.Range | Some e -> e + let startRange = match $1 with Some (ident:Ident) -> ident.idRange | None -> $2.Range + let m = unionRanges startRange arg.Range + ({ TypeName=$2; ArgExpr=arg; Target=$1; AppliesToGetterAndSetter=false; Range=m } : SynAttribute) } /* A custom attribute with an attribute target */ | attributeTarget OBLOCKBEGIN path oblockend opt_HIGH_PRECEDENCE_APP opt_atomicExprAfterType { let arg = match $6 with None -> mkSynUnit $3.Range | Some e -> e - ({ TypeName=$3; ArgExpr=arg; Target=$1; AppliesToGetterAndSetter=false; Range=$3.Range } : SynAttribute) } + let startRange = match $1 with Some ident -> ident.idRange | None -> $3.Range + let m = unionRanges startRange arg.Range + ({ TypeName=$3; ArgExpr=arg; Target=$1; AppliesToGetterAndSetter=false; Range=m } : SynAttribute) } /* The target of a custom attribute */ @@ -1863,7 +1868,7 @@ memberCore: let xmlDoc = grabXmlDocAtRangeStart(parseState, attrs, rangeStart) let memberFlags = Some (memFlagsBuilder SynMemberKind.Member) let mWholeBindLhs = (mBindLhs, attrs) ||> unionRangeWithListBy (fun (a: SynAttributeList) -> a.Range) - let trivia: SynBindingTrivia = { LetKeyword = None; EqualsRange = Some mEquals } + let trivia: SynBindingTrivia = { LetKeyword = None; EqualsRange = Some mEquals; ExternKeyword = None } let binding = mkSynBinding (xmlDoc, bindingPat) (vis, $1, false, mWholeBindLhs, DebugPointAtBinding.NoneAtInvisible, optReturnType, $5, mRhs, [], attrs, memberFlags, trivia) let memberRange = unionRanges rangeStart mRhs |> unionRangeWithXmlDoc xmlDoc [ SynMemberDefn.Member (binding, memberRange) ]) } @@ -1980,7 +1985,7 @@ classDefnMember: let declPat = SynPat.LongIdent (SynLongIdent([mkSynId (rhs parseState 3) "new"], [], [None]), None, Some noInferredTypars, SynArgPats.Pats [$4], vis, rhs parseState 3) // Check that 'SynPatForConstructorDecl' matches this correctly assert (match declPat with SynPatForConstructorDecl _ -> true | _ -> false) - let synBindingTrivia: SynBindingTrivia = { LetKeyword = None; EqualsRange = Some mEquals } + let synBindingTrivia: SynBindingTrivia = { LetKeyword = None; EqualsRange = Some mEquals; ExternKeyword = None } [ SynMemberDefn.Member(SynBinding (None, SynBindingKind.Normal, false, false, $1, xmlDoc, valSynData, declPat, None, expr, mWholeBindLhs, DebugPointAtBinding.NoneAtInvisible, synBindingTrivia), m) ] } | opt_attributes opt_declVisibility STATIC typeKeyword tyconDefn @@ -2738,7 +2743,8 @@ hardwhiteDefnBindingsTerminator: /* An 'extern' DllImport function definition in C-style syntax */ cPrototype: | EXTERN cRetType opt_access ident opt_HIGH_PRECEDENCE_APP LPAREN externArgs rparen - { let rty, vis, nm, args = $2, $3, $4, $7 + { let mExtern = rhs parseState 1 + let rty, vis, nm, args = $2, $3, $4, $7 let nmm = rhs parseState 3 let argsm = rhs parseState 6 let mBindLhs = lhs parseState @@ -2755,10 +2761,11 @@ cPrototype: let bindingPat = SynPat.LongIdent (SynLongIdent([nm], [], [None]), None, Some noInferredTypars, SynArgPats.Pats [SynPat.Tuple(false, args, argsm)], vis, nmm) let mWholeBindLhs = (mBindLhs, attrs) ||> unionRangeWithListBy (fun (a: SynAttributeList) -> a.Range) let xmlDoc = grabXmlDoc(parseState, attrs, 1) + let trivia = { LetKeyword = None; ExternKeyword = Some mExtern; EqualsRange = None } let binding = mkSynBinding (xmlDoc, bindingPat) - (vis, false, false, mWholeBindLhs, DebugPointAtBinding.NoneAtInvisible, Some rty, rhsExpr, mRhs, [], attrs, None, SynBindingTrivia.Zero) + (vis, false, false, mWholeBindLhs, DebugPointAtBinding.NoneAtInvisible, Some rty, rhsExpr, mRhs, [], attrs, None, trivia) [], [binding]) } /* A list of arguments in an 'extern' DllImport function definition */ @@ -2877,7 +2884,7 @@ localBinding: let mWhole = (unionRanges mLetKwd mRhs, attrs) ||> unionRangeWithListBy (fun (a: SynAttributeList) -> a.Range) let spBind = if IsDebugPointBinding bindingPat expr then DebugPointAtBinding.Yes mWhole else DebugPointAtBinding.NoneAtLet let mWholeBindLhs = (mBindLhs, attrs) ||> unionRangeWithListBy (fun (a: SynAttributeList) -> a.Range) - let trivia: SynBindingTrivia = { LetKeyword = Some mLetKwd; EqualsRange = Some mEquals } + let trivia: SynBindingTrivia = { LetKeyword = Some mLetKwd; EqualsRange = Some mEquals; ExternKeyword = None } mkSynBinding (xmlDoc, bindingPat) (vis, $1, $2, mWholeBindLhs, spBind, optReturnType, expr, mRhs, opts, attrs, None, trivia)) localBindingRange, localBindingBuilder } @@ -2892,7 +2899,7 @@ localBinding: let zeroWidthAtEnd = mEquals.EndRange let rhsExpr = arbExpr("localBinding1", zeroWidthAtEnd) let spBind = if IsDebugPointBinding bindingPat rhsExpr then DebugPointAtBinding.Yes mWhole else DebugPointAtBinding.NoneAtLet - let trivia: SynBindingTrivia = { LetKeyword = Some mLetKwd; EqualsRange = Some mEquals } + let trivia: SynBindingTrivia = { LetKeyword = Some mLetKwd; EqualsRange = Some mEquals; ExternKeyword = None } mkSynBinding (xmlDoc, bindingPat) (vis, $1, $2, mBindLhs, spBind, optReturnType, rhsExpr, mRhs, [], attrs, None, trivia)) mWhole, localBindingBuilder } @@ -2905,7 +2912,7 @@ localBinding: let localBindingBuilder = (fun xmlDoc attrs vis mLetKwd -> let spBind = DebugPointAtBinding.Yes (unionRanges mLetKwd mRhs) - let trivia = { LetKeyword = Some mLetKwd; EqualsRange = None } + let trivia = { LetKeyword = Some mLetKwd; EqualsRange = None; ExternKeyword = None } let rhsExpr = arbExpr("localBinding2", mRhs) mkSynBinding (xmlDoc, bindingPat) (vis, $1, $2, mBindLhs, spBind, optReturnType, rhsExpr, mRhs, [], attrs, None, trivia)) mWhole, localBindingBuilder } @@ -3124,10 +3131,13 @@ headBindingPattern: SynPat.Or($1, $3, rhs2 parseState 1 3, { BarRange = mBar }) } | headBindingPattern COLON_COLON headBindingPattern - { SynPat.LongIdent (SynLongIdent(mkSynCaseName (rhs parseState 2) opNameCons, [], [ Some (IdentTrivia.OriginalNotation "::") ]), None, None, SynArgPats.Pats [SynPat.Tuple (false, [$1;$3], rhs2 parseState 1 3)], None, lhs parseState) } + { let mColonColon = rhs parseState 2 + SynPat.ListCons($1, $3, rhs2 parseState 1 3, { ColonColonRange = mColonColon }) } - | tuplePatternElements %prec pat_tuple - { SynPat.Tuple(false, List.rev $1, lhs parseState) } + | tuplePatternElements %prec pat_tuple + { let pats = normalizeTuplePat $1 + let m = (rhs parseState 1, pats) ||> unionRangeWithListBy (fun p -> p.Range) + SynPat.Tuple(false, List.rev pats, m) } | conjPatternElements %prec pat_conj { SynPat.Ands(List.rev $1, lhs parseState) } @@ -3135,12 +3145,37 @@ headBindingPattern: | constrPattern { $1 } -tuplePatternElements: - | tuplePatternElements COMMA headBindingPattern +tuplePatternElements: + | tuplePatternElements COMMA headBindingPattern { $3 :: $1 } - | headBindingPattern COMMA headBindingPattern - { $3 :: $1 :: [] } + | headBindingPattern COMMA headBindingPattern + { [$3; $1] } + + | tuplePatternElements COMMA ends_coming_soon_or_recover + { let commaRange = rhs parseState 2 + reportParseErrorAt commaRange (FSComp.SR.parsExpectingPatternInTuple ()) + let pat2 = SynPat.Wild(commaRange.EndRange) + pat2 :: $1 } + + | headBindingPattern COMMA ends_coming_soon_or_recover + { let commaRange = rhs parseState 2 + reportParseErrorAt commaRange (FSComp.SR.parsExpectingPatternInTuple ()) + let pat2 = SynPat.Wild(commaRange.EndRange) + [pat2; $1] } + + | COMMA headBindingPattern + { let commaRange = rhs parseState 1 + reportParseErrorAt commaRange (FSComp.SR.parsExpectingPatternInTuple ()) + let pat1 = SynPat.Wild(commaRange.StartRange) + [$2; pat1] } + + | COMMA ends_coming_soon_or_recover + { let commaRange = rhs parseState 1 + if not $2 then reportParseErrorAt commaRange (FSComp.SR.parsExpectedPatternAfterToken ()) + let pat1 = SynPat.Wild(commaRange.StartRange) + let pat2 = SynPat.Wild(commaRange.EndRange) + [pat2; pat1] } conjPatternElements: | conjPatternElements AMP headBindingPattern @@ -3210,7 +3245,10 @@ constrPattern: atomicPatsOrNamePatPairs: | LPAREN namePatPairs rparen - { SynArgPats.NamePatPairs $2, snd $2 } + { let mParen = rhs2 parseState 1 3 + let pats, m = $2 + let trivia = { ParenRange = mParen } + SynArgPats.NamePatPairs(pats, m, trivia), snd $2 } | atomicPatterns { let mParsed = rhs parseState 1 @@ -3351,8 +3389,10 @@ parenPattern: { let mBar = rhs parseState 2 SynPat.Or($1, $3, rhs2 parseState 1 3, { BarRange = mBar }) } - | tupleParenPatternElements - { SynPat.Tuple(false, List.rev $1, lhs parseState) } + | tupleParenPatternElements + { let pats = normalizeTuplePat $1 + let m = (rhs parseState 1, pats) ||> unionRangeWithListBy (fun p -> p.Range) + SynPat.Tuple(false, List.rev pats, m) } | conjParenPatternElements { SynPat.Ands(List.rev $1, rhs2 parseState 1 3) } @@ -3366,16 +3406,42 @@ parenPattern: SynPat.Attrib($2, $1, mLhs) } | parenPattern COLON_COLON parenPattern - { SynPat.LongIdent (SynLongIdent(mkSynCaseName (rhs parseState 2) opNameCons, [], [ Some (IdentTrivia.OriginalNotation "::") ]), None, None, SynArgPats.Pats [ SynPat.Tuple (false, [$1;$3], rhs2 parseState 1 3) ], None, lhs parseState) } + { let mColonColon = rhs parseState 2 + SynPat.ListCons($1, $3, rhs2 parseState 1 3, { ColonColonRange = mColonColon }) } | constrPattern { $1 } tupleParenPatternElements: - | tupleParenPatternElements COMMA parenPattern + | tupleParenPatternElements COMMA parenPattern { $3 :: $1 } - | parenPattern COMMA parenPattern - { $3 :: $1 :: [] } + | parenPattern COMMA parenPattern + { [$3; $1] } + + | tupleParenPatternElements COMMA ends_coming_soon_or_recover + { let commaRange = rhs parseState 2 + reportParseErrorAt commaRange (FSComp.SR.parsExpectingPatternInTuple()) + let pat2 = SynPat.Wild(commaRange.EndRange) + pat2 :: $1 } + + | parenPattern COMMA ends_coming_soon_or_recover + { let commaRange = rhs parseState 2 + reportParseErrorAt commaRange (FSComp.SR.parsExpectingPatternInTuple()) + let pat2 = SynPat.Wild(commaRange.EndRange) + [pat2; $1] } + + | COMMA parenPattern + { let commaRange = rhs parseState 1 + reportParseErrorAt commaRange (FSComp.SR.parsExpectingPatternInTuple()) + let pat1 = SynPat.Wild(commaRange.StartRange) + [$2; pat1] } + + | COMMA ends_coming_soon_or_recover + { let commaRange = rhs parseState 1 + if not $2 then reportParseErrorAt commaRange (FSComp.SR.parsExpectedPatternAfterToken ()) + let pat1 = SynPat.Wild(commaRange.StartRange) + let pat2 = SynPat.Wild(commaRange.EndRange) + [pat2; pat1] } conjParenPatternElements: | conjParenPatternElements AMP parenPattern diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index 822297d4ff9..edd370fe467 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -592,6 +592,16 @@ Neočekávaný token v definici typu. Za typem {0} se očekává =. + + Expected a pattern after this point + Expected a pattern after this point + + + + Expecting pattern + Expecting pattern + + Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) Neúplný znakový literál (příklad: Q) nebo volání kvalifikovaného typu (příklad: T.Name) @@ -3783,8 +3793,8 @@ - This union case expects {0} arguments in tupled form - Tento případ typu union očekává argumenty v počtu {0} v podobě řazené kolekce členů. + This union case expects {0} arguments in tupled form, but was given {1}. The missing field arguments may be any of:{2} + This union case expects {0} arguments in tupled form, but was given {1}. The missing field arguments may be any of:{2} diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index afb89b3f305..a56cade1c09 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -592,6 +592,16 @@ Unerwartetes Token in Typdefinition. Nach Typ "{0}" wurde "=" erwartet. + + Expected a pattern after this point + Expected a pattern after this point + + + + Expecting pattern + Expecting pattern + + Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) Unvollständiges Zeichenliteral (Beispiel: „Q“) oder qualifizierter Typaufruf (Beispiel: „T.Name“) @@ -3783,8 +3793,8 @@ - This union case expects {0} arguments in tupled form - Dieser Union-Fall erwartet {0} Argumente als Tupel. + This union case expects {0} arguments in tupled form, but was given {1}. The missing field arguments may be any of:{2} + This union case expects {0} arguments in tupled form, but was given {1}. The missing field arguments may be any of:{2} diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index 7bff656b19d..ce338b5124c 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -592,6 +592,16 @@ Token inesperado en la definición de tipo. Se esperaba "=" después del tipo "{0}". + + Expected a pattern after this point + Expected a pattern after this point + + + + Expecting pattern + Expecting pattern + + Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) Literal de carácter incompleto (ejemplo: 'Q') o invocación de tipo completo (ejemplo: 'T.Name) @@ -3783,8 +3793,8 @@ - This union case expects {0} arguments in tupled form - Este caso de unión espera {0} argumentos en forma de tupla. + This union case expects {0} arguments in tupled form, but was given {1}. The missing field arguments may be any of:{2} + This union case expects {0} arguments in tupled form, but was given {1}. The missing field arguments may be any of:{2} diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index 9e4bb29ee0c..8718d5db4e9 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -592,6 +592,16 @@ Jeton inattendu dans la définition de type. Signe '=' attendu après le type '{0}'. + + Expected a pattern after this point + Expected a pattern after this point + + + + Expecting pattern + Expecting pattern + + Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) Littéral de caractère incomplet (exemple : 'Q') ou appel de type qualifié (exemple : 'T.Name) @@ -3783,8 +3793,8 @@ - This union case expects {0} arguments in tupled form - Ce cas d'union attend {0} arguments basés sur des tuples + This union case expects {0} arguments in tupled form, but was given {1}. The missing field arguments may be any of:{2} + This union case expects {0} arguments in tupled form, but was given {1}. The missing field arguments may be any of:{2} diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 6e56bbe7ee8..1c3deaeb130 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -592,6 +592,16 @@ Token imprevisto nella definizione del tipo. Dopo il tipo '{0}' è previsto '='. + + Expected a pattern after this point + Expected a pattern after this point + + + + Expecting pattern + Expecting pattern + + Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) Valore letterale carattere incompleto (ad esempio: 'Q') o chiamata di tipo qualificato (ad esempio: 'T.Name) @@ -3783,8 +3793,8 @@ - This union case expects {0} arguments in tupled form - Questo case di unione prevede {0} argomenti sotto forma di tupla + This union case expects {0} arguments in tupled form, but was given {1}. The missing field arguments may be any of:{2} + This union case expects {0} arguments in tupled form, but was given {1}. The missing field arguments may be any of:{2} diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index 18b818fea07..06c51c429d4 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -592,6 +592,16 @@ 型定義に予期しないトークンがあります。型 '{0}' の後には '=' が必要です。 + + Expected a pattern after this point + Expected a pattern after this point + + + + Expecting pattern + Expecting pattern + + Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) @@ -3783,8 +3793,8 @@ - This union case expects {0} arguments in tupled form - この共用体ケースにはタプル形式の引数を {0} 個指定してください + This union case expects {0} arguments in tupled form, but was given {1}. The missing field arguments may be any of:{2} + This union case expects {0} arguments in tupled form, but was given {1}. The missing field arguments may be any of:{2} diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 052d424f56f..dbf570b4be7 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -592,6 +592,16 @@ 형식 정의에 예기치 않은 토큰이 있습니다. '{0}' 형식 뒤에 '='가 필요합니다. + + Expected a pattern after this point + Expected a pattern after this point + + + + Expecting pattern + Expecting pattern + + Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) 불완전한 문자 리터럴(예: 'Q') 또는 정규화된 형식 호출(예: 'T.Name) @@ -3783,8 +3793,8 @@ - This union case expects {0} arguments in tupled form - 이 공용 구조체 케이스에는 튜플된 형식의 인수 {0}개가 필요합니다. + This union case expects {0} arguments in tupled form, but was given {1}. The missing field arguments may be any of:{2} + This union case expects {0} arguments in tupled form, but was given {1}. The missing field arguments may be any of:{2} diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index eb4a2819499..15589cd24ab 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -592,6 +592,16 @@ Nieoczekiwany token w definicji typu. Oczekiwano znaku „=” po typie „{0}”. + + Expected a pattern after this point + Expected a pattern after this point + + + + Expecting pattern + Expecting pattern + + Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) Niekompletny literał znaku (przykład: „Q”) lub wywołanie typu kwalifikowanego (przykład: „T.Name”) @@ -3783,8 +3793,8 @@ - This union case expects {0} arguments in tupled form - Ten przypadek unii oczekuje {0} argumentów w postaci spójnej kolekcji + This union case expects {0} arguments in tupled form, but was given {1}. The missing field arguments may be any of:{2} + This union case expects {0} arguments in tupled form, but was given {1}. The missing field arguments may be any of:{2} diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 04e91c3089b..71212e1cd43 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -592,6 +592,16 @@ Token inesperado na definição de tipo. Esperava-se '=' após o tipo '{0}'. + + Expected a pattern after this point + Expected a pattern after this point + + + + Expecting pattern + Expecting pattern + + Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) Literal de caractere incompleto (exemplo: 'Q') ou invocação de tipo qualificado (exemplo: 'T.Name) @@ -3783,8 +3793,8 @@ - This union case expects {0} arguments in tupled form - Este caso união espera argumentos {0} na forma de tupla + This union case expects {0} arguments in tupled form, but was given {1}. The missing field arguments may be any of:{2} + This union case expects {0} arguments in tupled form, but was given {1}. The missing field arguments may be any of:{2} diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index 29bdaf2512e..c5191baf446 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -592,6 +592,16 @@ Неожиданный токен в определении типа. После типа "{0}" ожидается "=". + + Expected a pattern after this point + Expected a pattern after this point + + + + Expecting pattern + Expecting pattern + + Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) Неполный символьный литерал (например: "Q") или вызов квалифицированного типа (например: "T.Name) @@ -3783,8 +3793,8 @@ - This union case expects {0} arguments in tupled form - Для данного случая объединения требуется {0} аргументов в форме кортежа + This union case expects {0} arguments in tupled form, but was given {1}. The missing field arguments may be any of:{2} + This union case expects {0} arguments in tupled form, but was given {1}. The missing field arguments may be any of:{2} diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index 4b1b2804206..f840cc2a2ed 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -592,6 +592,16 @@ Tür tanımında beklenmeyen belirteç var. '{0}' türünden sonra '=' bekleniyordu. + + Expected a pattern after this point + Expected a pattern after this point + + + + Expecting pattern + Expecting pattern + + Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) Eksik karakter değişmez değeri (örnek: 'Q') veya tam tür çağrısı (örnek: 'T.Name) @@ -3783,8 +3793,8 @@ - This union case expects {0} arguments in tupled form - Bu birleşim durumu grup olarak tanımlanmış biçimde {0} bağımsız değişken bekliyor + This union case expects {0} arguments in tupled form, but was given {1}. The missing field arguments may be any of:{2} + This union case expects {0} arguments in tupled form, but was given {1}. The missing field arguments may be any of:{2} diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index 653c27378ca..908d33e58bd 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -592,6 +592,16 @@ 类型定义中出现意外标记。类型“{0}”后应为 "="。 + + Expected a pattern after this point + Expected a pattern after this point + + + + Expecting pattern + Expecting pattern + + Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) 字符文本不完整(示例: "Q")或限定类型调用(示例: "T.Name") @@ -3783,8 +3793,8 @@ - This union case expects {0} arguments in tupled form - 此联合用例需要 {0} 个元组格式的参数 + This union case expects {0} arguments in tupled form, but was given {1}. The missing field arguments may be any of:{2} + This union case expects {0} arguments in tupled form, but was given {1}. The missing field arguments may be any of:{2} diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index 781002375e3..24faf41e95c 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -592,6 +592,16 @@ 型別定義中出現非預期的權杖。類型 '{0}' 之後應該要有 '='。 + + Expected a pattern after this point + Expected a pattern after this point + + + + Expecting pattern + Expecting pattern + + Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) @@ -3783,8 +3793,8 @@ - This union case expects {0} arguments in tupled form - 這個聯集需要 {0} 個 Tuple 形式的引數 + This union case expects {0} arguments in tupled form, but was given {1}. The missing field arguments may be any of:{2} + This union case expects {0} arguments in tupled form, but was given {1}. The missing field arguments may be any of:{2} diff --git a/src/FSharp.Core/prim-types.fs b/src/FSharp.Core/prim-types.fs index eb92de29cba..0489528c062 100644 --- a/src/FSharp.Core/prim-types.fs +++ b/src/FSharp.Core/prim-types.fs @@ -601,20 +601,19 @@ namespace Microsoft.FSharp.Core // duplicated from above since we're using integers in this section let CompilationRepresentationFlags_PermitNull = 8 - let getTypeInfo (ty:Type) = - if ty.IsValueType + let private getTypeInfo<'T> = + if typeof<'T>.IsValueType then TypeNullnessSemantics_NullNever else - let mappingAttrs = ty.GetCustomAttributes(typeof, false) - if mappingAttrs.Length = 0 + if not (typeof<'T>.IsDefined(typeof, false)) then TypeNullnessSemantics_NullIsExtraValue - elif ty.Equals(typeof) then + elif typeof<'T>.Equals(typeof) then TypeNullnessSemantics_NullTrueValue - elif typeof.IsAssignableFrom(ty) then + elif typeof.IsAssignableFrom(typeof<'T>) then TypeNullnessSemantics_NullIsExtraValue - elif ty.GetCustomAttributes(typeof, false).Length > 0 then + elif typeof<'T>.IsDefined(typeof, false) then TypeNullnessSemantics_NullIsExtraValue else - let reprAttrs = ty.GetCustomAttributes(typeof, false) + let reprAttrs = typeof<'T>.GetCustomAttributes(typeof, false) if reprAttrs.Length = 0 then TypeNullnessSemantics_NullNotLiked else @@ -627,7 +626,7 @@ namespace Microsoft.FSharp.Core type TypeInfo<'T>() = // Compute an on-demand per-instantiation static field - static let info = getTypeInfo typeof<'T> + static let info = getTypeInfo<'T> // Publish the results of that computation static member TypeInfo = info diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn.fs index 1ba362eb86a..4e98ff92545 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn.fs @@ -70,6 +70,18 @@ module TestCompilerWarningLevel = |> withDiagnosticMessageMatches "The value has been copied to ensure the original is not mutated by this operation or because the copy is implicit when returning a struct from a member and another member is then accessed$" |> ignore +#if NETSTANDARD +// This test works with KeyValuePair, which is not a 'readonly struct' in net472 + [] + let ``no error 52 with readonly struct`` compilation = + compilation + |> asExe + |> withOptions ["--warn:5"; "--warnaserror:52"] + |> compile + |> shouldSucceed + |> ignore +#endif + [] let ``warn_level6_fs --warn:6`` compilation = compilation diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicTypeAndModuleDefinitions/GeneratedEqualityHashingComparison/Attributes/Diags/Diags.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicTypeAndModuleDefinitions/GeneratedEqualityHashingComparison/Attributes/Diags/Diags.fs index 295ee002be7..95fe85e3678 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicTypeAndModuleDefinitions/GeneratedEqualityHashingComparison/Attributes/Diags/Diags.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicTypeAndModuleDefinitions/GeneratedEqualityHashingComparison/Attributes/Diags/Diags.fs @@ -17,7 +17,7 @@ module Diags = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 7, Col 3, Line 7, Col 23, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") + (Error 501, Line 7, Col 3, Line 7, Col 30, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") ] // SOURCE=E_AdjustUses01b.fs SCFLAGS=--test:ErrorRanges # E_AdjustUses01b.fs @@ -28,6 +28,6 @@ module Diags = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 7, Col 3, Line 7, Col 23, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") + (Error 501, Line 7, Col 3, Line 7, Col 30, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") ] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicTypeAndModuleDefinitions/GeneratedEqualityHashingComparison/Attributes/Legacy/Legacy.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicTypeAndModuleDefinitions/GeneratedEqualityHashingComparison/Attributes/Legacy/Legacy.fs index e26e9b5d08b..af9e9f3472e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicTypeAndModuleDefinitions/GeneratedEqualityHashingComparison/Attributes/Legacy/Legacy.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicTypeAndModuleDefinitions/GeneratedEqualityHashingComparison/Attributes/Legacy/Legacy.fs @@ -17,9 +17,9 @@ module Legacy = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 7, Col 5, Line 7, Col 22, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") - (Error 501, Line 8, Col 5, Line 8, Col 25, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") - (Error 501, Line 9, Col 5, Line 9, Col 23, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") + (Error 501, Line 7, Col 5, Line 7, Col 28, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") + (Error 501, Line 8, Col 5, Line 8, Col 31, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") + (Error 501, Line 9, Col 5, Line 9, Col 29, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") ] // SOURCE=Test02.fs SCFLAGS="--test:ErrorRanges" # Test02.fs @@ -30,9 +30,9 @@ module Legacy = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 8, Col 5, Line 8, Col 22, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") - (Error 501, Line 9, Col 5, Line 9, Col 25, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") - (Error 501, Line 10, Col 5, Line 10, Col 23, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") + (Error 501, Line 8, Col 5, Line 8, Col 28, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") + (Error 501, Line 9, Col 5, Line 9, Col 31, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") + (Error 501, Line 10, Col 5, Line 10, Col 30, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") ] // SOURCE=Test03.fs SCFLAGS="--test:ErrorRanges" # Test03.fs @@ -43,8 +43,8 @@ module Legacy = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 7, Col 5, Line 7, Col 22, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") - (Error 501, Line 8, Col 5, Line 8, Col 25, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") + (Error 501, Line 7, Col 5, Line 7, Col 28, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") + (Error 501, Line 8, Col 5, Line 8, Col 31, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") ] // SOURCE=Test04.fs SCFLAGS="--test:ErrorRanges" # Test04.fs @@ -55,9 +55,9 @@ module Legacy = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 7, Col 5, Line 7, Col 22, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") - (Error 501, Line 8, Col 5, Line 8, Col 25, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") - (Error 501, Line 9, Col 5, Line 9, Col 23, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") + (Error 501, Line 7, Col 5, Line 7, Col 28, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") + (Error 501, Line 8, Col 5, Line 8, Col 32, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") + (Error 501, Line 9, Col 5, Line 9, Col 29, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") ] // SOURCE=Test05.fs SCFLAGS="--test:ErrorRanges" # Test05.fs @@ -68,9 +68,9 @@ module Legacy = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 7, Col 5, Line 7, Col 22, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") - (Error 501, Line 8, Col 5, Line 8, Col 25, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") - (Error 501, Line 9, Col 5, Line 9, Col 23, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") + (Error 501, Line 7, Col 5, Line 7, Col 28, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") + (Error 501, Line 8, Col 5, Line 8, Col 32, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") + (Error 501, Line 9, Col 5, Line 9, Col 30, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") ] // SOURCE=Test06.fs SCFLAGS="--test:ErrorRanges" # Test06.fs @@ -81,8 +81,8 @@ module Legacy = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 7, Col 5, Line 7, Col 22, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") - (Error 501, Line 8, Col 5, Line 8, Col 25, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") + (Error 501, Line 7, Col 5, Line 7, Col 28, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") + (Error 501, Line 8, Col 5, Line 8, Col 32, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") ] // SOURCE=Test07.fs SCFLAGS="--test:ErrorRanges" # Test07.fs @@ -93,8 +93,8 @@ module Legacy = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 7, Col 5, Line 7, Col 22, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") - (Error 501, Line 9, Col 5, Line 9, Col 23, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") + (Error 501, Line 7, Col 5, Line 7, Col 28, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") + (Error 501, Line 9, Col 5, Line 9, Col 29, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") ] // SOURCE=Test08.fs SCFLAGS="--test:ErrorRanges" # Test08.fs @@ -105,8 +105,8 @@ module Legacy = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 7, Col 5, Line 7, Col 22, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") - (Error 501, Line 9, Col 5, Line 9, Col 23, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") + (Error 501, Line 7, Col 5, Line 7, Col 28, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") + (Error 501, Line 9, Col 5, Line 9, Col 30, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") ] // SOURCE=Test09.fs SCFLAGS="--test:ErrorRanges" # Test09.fs @@ -117,7 +117,7 @@ module Legacy = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 6, Col 5, Line 6, Col 22, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") + (Error 501, Line 6, Col 5, Line 6, Col 28, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") ] // SOURCE=Test10.fs SCFLAGS="--test:ErrorRanges" # Test10.fs @@ -128,9 +128,9 @@ module Legacy = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 8, Col 5, Line 8, Col 22, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") - (Error 501, Line 9, Col 5, Line 9, Col 25, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") - (Error 501, Line 10, Col 5, Line 10, Col 23, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") + (Error 501, Line 8, Col 5, Line 8, Col 29, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") + (Error 501, Line 9, Col 5, Line 9, Col 31, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") + (Error 501, Line 10, Col 5, Line 10, Col 29, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") ] // SOURCE=Test11.fs SCFLAGS="--test:ErrorRanges" # Test11.fs @@ -141,9 +141,9 @@ module Legacy = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 8, Col 5, Line 8, Col 22, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") - (Error 501, Line 9, Col 5, Line 9, Col 25, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") - (Error 501, Line 10, Col 5, Line 10, Col 23, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") + (Error 501, Line 8, Col 5, Line 8, Col 29, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") + (Error 501, Line 9, Col 5, Line 9, Col 31, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") + (Error 501, Line 10, Col 5, Line 10, Col 30, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") ] // SOURCE=Test12.fs SCFLAGS="--test:ErrorRanges" # Test12.fs @@ -154,8 +154,8 @@ module Legacy = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 7, Col 5, Line 7, Col 22, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") - (Error 501, Line 8, Col 5, Line 8, Col 25, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") + (Error 501, Line 7, Col 5, Line 7, Col 29, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") + (Error 501, Line 8, Col 5, Line 8, Col 31, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") ] // SOURCE=Test13.fs SCFLAGS="--test:ErrorRanges" # Test13.fs @@ -166,9 +166,9 @@ module Legacy = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 7, Col 5, Line 7, Col 22, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") - (Error 501, Line 8, Col 5, Line 8, Col 25, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") - (Error 501, Line 9, Col 5, Line 9, Col 23, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") + (Error 501, Line 7, Col 5, Line 7, Col 29, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") + (Error 501, Line 8, Col 5, Line 8, Col 32, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") + (Error 501, Line 9, Col 5, Line 9, Col 29, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") ] // SOURCE=Test14.fs SCFLAGS="--test:ErrorRanges" # Test14.fs @@ -179,9 +179,9 @@ module Legacy = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 9, Col 5, Line 9, Col 22, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") - (Error 501, Line 10, Col 5, Line 10, Col 25, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") - (Error 501, Line 11, Col 5, Line 11, Col 23, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") + (Error 501, Line 9, Col 5, Line 9, Col 29, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") + (Error 501, Line 10, Col 5, Line 10, Col 32, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") + (Error 501, Line 11, Col 5, Line 11, Col 30, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") ] // SOURCE=Test15.fs SCFLAGS="--test:ErrorRanges" # Test15.fs @@ -192,8 +192,8 @@ module Legacy = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 7, Col 5, Line 7, Col 22, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") - (Error 501, Line 8, Col 5, Line 8, Col 25, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") + (Error 501, Line 7, Col 5, Line 7, Col 29, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") + (Error 501, Line 8, Col 5, Line 8, Col 32, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") ] // SOURCE=Test16.fs SCFLAGS="--test:ErrorRanges" # Test16.fs @@ -204,8 +204,8 @@ module Legacy = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 7, Col 5, Line 7, Col 22, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") - (Error 501, Line 9, Col 5, Line 9, Col 23, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") + (Error 501, Line 7, Col 5, Line 7, Col 29, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") + (Error 501, Line 9, Col 5, Line 9, Col 29, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") ] // SOURCE=Test17.fs SCFLAGS="--test:ErrorRanges" # Test17.fs @@ -216,8 +216,8 @@ module Legacy = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 6, Col 5, Line 6, Col 22, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") - (Error 501, Line 8, Col 5, Line 8, Col 23, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") + (Error 501, Line 6, Col 5, Line 6, Col 29, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") + (Error 501, Line 8, Col 5, Line 8, Col 30, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") ] // SOURCE=Test18.fs SCFLAGS="--test:ErrorRanges" # Test18.fs @@ -228,7 +228,7 @@ module Legacy = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 6, Col 5, Line 6, Col 22, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") + (Error 501, Line 6, Col 5, Line 6, Col 29, "The object constructor 'ReferenceEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> ReferenceEqualityAttribute'.") ] // SOURCE=Test19.fs SCFLAGS="--test:ErrorRanges" # Test19.fs @@ -239,8 +239,8 @@ module Legacy = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 7, Col 5, Line 7, Col 25, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") - (Error 501, Line 8, Col 5, Line 8, Col 23, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") + (Error 501, Line 7, Col 5, Line 7, Col 31, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") + (Error 501, Line 8, Col 5, Line 8, Col 29, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") ] // SOURCE=Test20.fs SCFLAGS="--test:ErrorRanges" # Test20.fs @@ -251,8 +251,8 @@ module Legacy = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 7, Col 5, Line 7, Col 25, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") - (Error 501, Line 8, Col 5, Line 8, Col 23, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") + (Error 501, Line 7, Col 5, Line 7, Col 31, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") + (Error 501, Line 8, Col 5, Line 8, Col 30, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") ] // SOURCE=Test21.fs SCFLAGS="--test:ErrorRanges" # Test21.fs @@ -263,7 +263,7 @@ module Legacy = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 6, Col 5, Line 6, Col 25, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") + (Error 501, Line 6, Col 5, Line 6, Col 31, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") ] // SOURCE=Test22.fs SCFLAGS="--test:ErrorRanges" # Test22.fs @@ -274,8 +274,8 @@ module Legacy = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 7, Col 5, Line 7, Col 25, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") - (Error 501, Line 8, Col 5, Line 8, Col 23, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") + (Error 501, Line 7, Col 5, Line 7, Col 32, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") + (Error 501, Line 8, Col 5, Line 8, Col 29, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") ] // SOURCE=Test23.fs SCFLAGS="--test:ErrorRanges" # Test23.fs @@ -286,8 +286,8 @@ module Legacy = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 9, Col 5, Line 9, Col 25, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") - (Error 501, Line 10, Col 5, Line 10, Col 23, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") + (Error 501, Line 9, Col 5, Line 9, Col 32, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") + (Error 501, Line 10, Col 5, Line 10, Col 30, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") ] // SOURCE=Test24.fs SCFLAGS="--test:ErrorRanges" # Test24.fs @@ -298,7 +298,7 @@ module Legacy = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 6, Col 5, Line 6, Col 25, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") + (Error 501, Line 6, Col 5, Line 6, Col 32, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.") ] // SOURCE=Test25.fs SCFLAGS="--test:ErrorRanges" # Test25.fs @@ -309,7 +309,7 @@ module Legacy = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 7, Col 5, Line 7, Col 23, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") + (Error 501, Line 7, Col 5, Line 7, Col 29, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") ] // SOURCE=Test26.fs SCFLAGS="--test:ErrorRanges" # Test26.fs @@ -320,7 +320,7 @@ module Legacy = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 7, Col 5, Line 7, Col 23, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") + (Error 501, Line 7, Col 5, Line 7, Col 30, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") ] // SOURCE=Test27.fs SCFLAGS="--test:ErrorRanges" # Test27.fs @@ -340,7 +340,7 @@ module Legacy = |> compile |> shouldFail |> withDiagnostics [ - (Error 501, Line 7, Col 3, Line 7, Col 21, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") + (Error 501, Line 7, Col 3, Line 7, Col 28, "The object constructor 'StructuralEqualityAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralEqualityAttribute'.") ] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/DeclarationElements/CustomAttributes/AttributeUsage/AttributeUsage.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/DeclarationElements/CustomAttributes/AttributeUsage/AttributeUsage.fs index eeac02384ab..0161db9cd6e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/DeclarationElements/CustomAttributes/AttributeUsage/AttributeUsage.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/DeclarationElements/CustomAttributes/AttributeUsage/AttributeUsage.fs @@ -79,8 +79,8 @@ module AttributeUsage = |> shouldFail |> withDiagnostics [ (Error 842, Line 21, Col 21, Line 21, Col 22, "This attribute is not valid for use on this language element") - (Error 842, Line 24, Col 28, Line 24, Col 29, "This attribute is not valid for use on this language element") - (Error 842, Line 27, Col 15, Line 27, Col 16, "This attribute is not valid for use on this language element") + (Error 842, Line 24, Col 21, Line 24, Col 29, "This attribute is not valid for use on this language element") + (Error 842, Line 27, Col 7, Line 27, Col 16, "This attribute is not valid for use on this language element") ] // SOURCE=E_AttributeTargets02.fs # E_AttributeTargets02.fs @@ -90,9 +90,9 @@ module AttributeUsage = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 842, Line 14, Col 17, Line 14, Col 34, "This attribute is not valid for use on this language element") - (Error 842, Line 24, Col 14, Line 24, Col 29, "This attribute is not valid for use on this language element") - (Error 842, Line 29, Col 25, Line 29, Col 40, "This attribute is not valid for use on this language element") + (Error 842, Line 14, Col 7, Line 14, Col 34, "This attribute is not valid for use on this language element") + (Error 842, Line 24, Col 7, Line 24, Col 36, "This attribute is not valid for use on this language element") + (Error 842, Line 29, Col 15, Line 29, Col 47, "This attribute is not valid for use on this language element") ] // SOURCE=E_ConditionalAttribute.fs SCFLAGS="--test:ErrorRanges" # E_ConditionalAttribute.fs diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/DeclarationElements/CustomAttributes/Basic/Basic.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/DeclarationElements/CustomAttributes/Basic/Basic.fs index 8bc5e456829..829d0f86f79 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/DeclarationElements/CustomAttributes/Basic/Basic.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/DeclarationElements/CustomAttributes/Basic/Basic.fs @@ -41,7 +41,7 @@ module Basic = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 841, Line 7, Col 12, Line 7, Col 49, "This attribute is not valid for use on this language element. Assembly attributes should be attached to a 'do ()' declaration, if necessary within an F# module.") + (Error 841, Line 7, Col 3, Line 7, Col 111, "This attribute is not valid for use on this language element. Assembly attributes should be attached to a 'do ()' declaration, if necessary within an F# module.") ] // SOURCE=E_AttributeApplication02.fs SCFLAGS="--test:ErrorRanges" # E_AttributeApplication02.fs @@ -106,8 +106,8 @@ module Basic = (Error 1, Line 10, Col 3, Line 10, Col 59, "This expression was expected to have type\n 'int array' \nbut here has type\n 'unit' ") (Error 267, Line 10, Col 3, Line 10, Col 59, "This is not a valid constant expression or custom attribute value") (Error 850, Line 10, Col 3, Line 10, Col 59, "This attribute cannot be used in this version of F#") - (Error 850, Line 13, Col 3, Line 13, Col 52, "This attribute cannot be used in this version of F#") - (Error 850, Line 16, Col 13, Line 16, Col 37, "This attribute cannot be used in this version of F#") + (Error 850, Line 13, Col 3, Line 13, Col 101, "This attribute cannot be used in this version of F#") + (Error 850, Line 16, Col 3, Line 16, Col 50, "This attribute cannot be used in this version of F#") ] // SOURCE=E_AttributeTargetSpecifications.fs # E_AttributeTargetSpecifications.fs @@ -305,7 +305,7 @@ module Basic = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 429, Line 16, Col 28, Line 16, Col 31, "The attribute type 'CA1' has 'AllowMultiple=false'. Multiple instances of this attribute cannot be attached to a single language element.") + (Error 429, Line 16, Col 28, Line 16, Col 37, "The attribute type 'CA1' has 'AllowMultiple=false'. Multiple instances of this attribute cannot be attached to a single language element.") ] // SOURCE=W_StructLayoutExplicit01.fs SCFLAGS="--test:ErrorRanges" PEVER="/Exp_Fail" # W_StructLayoutExplicit01.fs diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/DeclarationElements/LetBindings/Basic/Basic.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/DeclarationElements/LetBindings/Basic/Basic.fs index fc9e36d748e..c472ec9b0ea 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/DeclarationElements/LetBindings/Basic/Basic.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/DeclarationElements/LetBindings/Basic/Basic.fs @@ -53,9 +53,9 @@ module Basic = |> shouldFail |> withDiagnostics [ (Error 683, Line 14, Col 6, Line 14, Col 27, "Attributes are not allowed within patterns") - (Error 842, Line 14, Col 8, Line 14, Col 23, "This attribute is not valid for use on this language element") + (Error 842, Line 14, Col 8, Line 14, Col 25, "This attribute is not valid for use on this language element") (Error 683, Line 14, Col 42, Line 14, Col 63, "Attributes are not allowed within patterns") - (Error 842, Line 14, Col 44, Line 14, Col 59, "This attribute is not valid for use on this language element") + (Error 842, Line 14, Col 44, Line 14, Col 61, "This attribute is not valid for use on this language element") ] // SOURCE=E_ErrorsForInlineValue.fs SCFLAGS="--test:ErrorRanges" # E_ErrorsForInlineValue.fs diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StructDefensiveCopy/StructDefensiveCopy.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StructDefensiveCopy/StructDefensiveCopy.fs new file mode 100644 index 00000000000..fe7f88ff74a --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StructDefensiveCopy/StructDefensiveCopy.fs @@ -0,0 +1,158 @@ +module FSharp.Compiler.ComponentTests.EmittedIL.StructDefensiveCopy + +open Xunit +open System.IO +open FSharp.Test +open FSharp.Test.Compiler + +let verifyKeyValuePairInstanceMethodCall expectedIl = + FSharp """ +module StructUnion01 +open System.Runtime.CompilerServices +open System.Collections.Generic + +let doWork(kvp1:inref>) = + kvp1.ToString() + """ + |> ignoreWarnings + |> compile + |> shouldSucceed + |> verifyIL expectedIl + +#if NETSTANDARD +// KeyValuePair defined as a readonly struct (in C#) +[] +let ``Defensive copy can be skipped on read-only structs``() = + verifyKeyValuePairInstanceMethodCall [""" .method public static string doWork([in] valuetype [runtime]System.Collections.Generic.KeyValuePair`2& kvp1) cil managed + { + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: constrained. valuetype [runtime]System.Collections.Generic.KeyValuePair`2 + IL_0007: callvirt instance string [runtime]System.Object::ToString() + IL_000c: ret + } + +} """] + +#else +// KeyValuePair just a regular struct. Notice the "ldobj" instruction +[] +let ``Non readonly struct needs a defensive copy``() = + verifyKeyValuePairInstanceMethodCall [""" .method public static string doWork([in] valuetype [runtime]System.Collections.Generic.KeyValuePair`2& kvp1) cil managed + { + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 3 + .locals init (valuetype [runtime]System.Collections.Generic.KeyValuePair`2 V_0) + IL_0000: ldarg.0 + IL_0001: ldobj valuetype [runtime]System.Collections.Generic.KeyValuePair`2 + IL_0006: stloc.0 + IL_0007: ldloca.s V_0 + IL_0009: constrained. valuetype [runtime]System.Collections.Generic.KeyValuePair`2 + IL_000f: callvirt instance string [runtime]System.Object::ToString() + IL_0014: ret + } """] +#endif + +let verifyDateTimeExtensionMethodCall expectedIl = + FSharp """ +module DateTimeExtensionMethod + +open System +open System.Collections.Generic +open System.Runtime.CompilerServices + +[] +type DateTimeExtensions = + [] + static member PrintDate(d: inref) = d.ToString() + +let doWork(dt:inref) = + dt.PrintDate() + """ + |> ignoreWarnings + |> compile + |> shouldSucceed + |> verifyIL expectedIl + +#if NETSTANDARD +// DateTime defined as a readonly struct (in C#) +[] +let ``Defensive copy can be skipped for extension methods on read-only structs``() = + verifyDateTimeExtensionMethodCall [""" .method public static string doWork([in] valuetype [runtime]System.DateTime& dt) cil managed + { + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: constrained. [runtime]System.DateTime + IL_0007: callvirt instance string [runtime]System.Object::ToString() + IL_000c: ret + } """] + +#else +// DateTime just a regular struct. Notice the "ldobj" instruction +[] +let ``Non readonly struct needs a defensive copy when its extension method is called``() = + verifyDateTimeExtensionMethodCall [""" .method public static string doWork([in] valuetype [runtime]System.DateTime& dt) cil managed + { + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 3 + .locals init (valuetype [runtime]System.DateTime& V_0, + valuetype [runtime]System.DateTime V_1) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: ldobj [runtime]System.DateTime + IL_0008: stloc.1 + IL_0009: ldloca.s V_1 + IL_000b: constrained. [runtime]System.DateTime + IL_0011: callvirt instance string [runtime]System.Object::ToString() + IL_0016: ret + } """] +#endif + + +#if NETSTANDARD +[] +#endif +let ``Csharp extension method on a readonly struct does not need defensive copy``() = + let csLib = + CSharp """ +using System; +public static class DateTimeExtensionMethod +{ + public static string CustomPrintDate(this in DateTime d) + { + return d.Date.ToShortDateString(); + } +}""" |> withName "CsLib" + + FSharp """ +module DateTimeDefinedInCsharpUsage +open System +let doWork(dt:inref) = + dt.CustomPrintDate() + """ + |> withReferences [csLib] + |> ignoreWarnings + |> compile + |> shouldSucceed + |> verifyIL [""" .method public static string doWork([in] valuetype [runtime]System.DateTime& dt) cil managed + { + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call string [CsLib]DateTimeExtensionMethod::CustomPrintDate(valuetype [runtime]System.DateTime&) + IL_0006: ret + } """] + diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnionCasePatternMatchingErrors.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnionCasePatternMatchingErrors.fs new file mode 100644 index 00000000000..b64dff5176c --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnionCasePatternMatchingErrors.fs @@ -0,0 +1,72 @@ +module FSharp.Compiler.ComponentTests.ErrorMessages.UnionCasePatternMatchingErrors + +open Xunit +open FSharp.Test.Compiler + +[] +let ``Union matching error - Incomplete union fields`` () = + FSharp """ +module Tests +type U = + | B of f1:int list * {|X:string|} * f3:U * f4: (int * System.String) + +let x : U = failwith "" +let myVal = + match x with + | B -> 42""" + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 727, Line 9, Col 7, Line 9, Col 8, + "This union case expects 4 arguments in tupled form, but was given 0. The missing field arguments may be any of: +\tf1: int list +\t{| X: string |} +\tf3: U +\tf4: (int * System.String)") + +[] +let ``Union matching error - Named args - Name used twice`` () = + FSharp """ +module Tests +type U = + | B of field: int * int +let x : U = failwith "" +let myVal = + match x with + | B (field = x; field = z) -> let y = x + z + 1 in ()""" + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 3175, Line 8, Col 21, Line 8, Col 26, "Union case/exception field 'field' cannot be used more than once.") + +[] +let ``Union matching error - Multiple tupled args`` () = + FSharp """ +module Tests +type U = + | B of field: int * int + +let x : U = failwith "" +let myVal = + match x with + | B x z -> let y = x + z + 1 in ()""" + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 727, Line 9, Col 7, Line 9, Col 12, "This union case expects 2 arguments in tupled form, but was given 0. The missing field arguments may be any of: +\tfield: int +\tint") + +[] +let ``Union matching error - Missing field`` () = + FSharp """ +module Tests +type U = + | A + | B of int * int * int + +let myVal = + match A with + | A -> 15 + | B (x, _) -> 16""" + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 727, Line 10, Col 7, Line 10, Col 15, "This union case expects 3 arguments in tupled form, but was given 2. The missing field arguments may be any of: +\tint") \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnsupportedAttributes.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnsupportedAttributes.fs index 439b0bd7bdb..276bad5963c 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnsupportedAttributes.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnsupportedAttributes.fs @@ -27,7 +27,7 @@ type C() = Range = { StartLine = 3 StartColumn = 13 EndLine = 3 - EndColumn = 37 } + EndColumn = 41 } Message = "This attribute is currently unsupported by the F# compiler. Applying it will not achieve its intended effect." } { Error = Warning 202 @@ -41,7 +41,7 @@ type C() = Range = { StartLine = 6 StartColumn = 22 EndLine = 6 - EndColumn = 78 } + EndColumn = 82 } Message = "This attribute is currently unsupported by the F# compiler. Applying it will not achieve its intended effect." } { Error = Warning 202 diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index 4acda7d0cd7..0b5e005d7b7 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -134,6 +134,7 @@ + @@ -158,6 +159,7 @@ + diff --git a/tests/FSharp.Compiler.ComponentTests/Language/ObsoleteAttributeCheckingTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/ObsoleteAttributeCheckingTests.fs index c2fa57509fc..20e785370a3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/ObsoleteAttributeCheckingTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/ObsoleteAttributeCheckingTests.fs @@ -205,10 +205,80 @@ C.Update() |> shouldFail |> withDiagnostics [ (Error 101, Line 9, Col 1, Line 9, Col 9, "This construct is deprecated. Use B instead") - ] + ] [] - let ``Obsolete attribute is taken into account when used on an enum and invocation`` () = + let ``Obsolete attribute error is taken into account when used on a struct du and invocation`` () = + Fsx """ +open System +[] +[] +type Color = + | Red + | Green + +let c = Color.Red + """ + |> ignoreWarnings + |> compile + |> shouldFail + |> withDiagnostics [ + (Error 101, Line 9, Col 9, Line 9, Col 14, "This construct is deprecated. Use B instead") + ] + + [] + let ``Obsolete attribute error is taken into account when used on a du and invocation`` () = + Fsx """ +open System +[] +type Color = + | Red + | Green + +let c = Color.Red + """ + |> ignoreWarnings + |> compile + |> shouldFail + |> withDiagnostics [ + (Error 101, Line 8, Col 9, Line 8, Col 14, "This construct is deprecated. Use B instead") + ] + + [] + let ``Obsolete attribute error is taken into account when used on a du field and invocation`` () = + Fsx """ +open System +type Color = + | [] Red + | Green + +let c = Color.Red + """ + |> ignoreWarnings + |> compile + |> shouldFail + |> withDiagnostics [ + (Error 101, Line 7, Col 9, Line 7, Col 18, "This construct is deprecated. Use B instead") + ] + + [] + let ``Obsolete attribute warning is taken into account when used on a du field and invocation`` () = + Fsx """ +open System +type Color = + | [] Red + | Green + +let c = Color.Red + """ + |> compile + |> shouldFail + |> withDiagnostics [ + (Warning 44, Line 7, Col 9, Line 7, Col 18, "This construct is deprecated. Use B instead") + ] + + [] + let ``Obsolete attribute error is taken into account when used on an enum and invocation`` () = Fsx """ open System @@ -219,15 +289,14 @@ type Color = let c = Color.Red """ - |> ignoreWarnings |> compile |> shouldFail |> withDiagnostics [ (Error 101, Line 9, Col 9, Line 9, Col 14, "This construct is deprecated. Use B instead") ] - + [] - let ``Obsolete attribute is taken into account when used on an enum entry and invocation`` () = + let ``Obsolete attribute error is taken into account when used on an enum field and invocation`` () = Fsx """ open System @@ -237,9 +306,28 @@ type Color = let c = Color.Red """ - |> ignoreWarnings |> compile - |> shouldSucceed + |> shouldFail + |> withDiagnostics [ + (Error 101, Line 8, Col 9, Line 8, Col 18, "This construct is deprecated. Use B instead") + ] + + [] + let ``Obsolete attribute warning is taken into account when used on an enum field and invocation`` () = + Fsx """ +open System + +type Color = + | [] Red = 0 + | Green = 1 + +let c = Color.Red + """ + |> compile + |> shouldFail + |> withDiagnostics [ + (Warning 44, Line 8, Col 9, Line 8, Col 18, "This construct is deprecated. Use B instead") + ] [] let ``Obsolete attribute is taken into account when used on an type and use extension method`` () = @@ -899,6 +987,7 @@ Class.ObsoleteEvent |> ignore (Warning 44, Line 3, Col 1, Line 3, Col 20, "This construct is deprecated. Field is obsolete"); (Warning 44, Line 4, Col 1, Line 4, Col 21, "This construct is deprecated. Method is obsolete"); (Warning 44, Line 5, Col 1, Line 5, Col 23, "This construct is deprecated. Property is obsolete") + (Warning 44, Line 6, Col 1, Line 6, Col 20, "This construct is deprecated. Event is obsolete") ] [] @@ -937,4 +1026,5 @@ Class.ObsoleteEvent |> ignore (Error 101, Line 3, Col 1, Line 3, Col 20, "This construct is deprecated. Field is obsolete"); (Error 101, Line 4, Col 1, Line 4, Col 21, "This construct is deprecated. Method is obsolete"); (Error 101, Line 5, Col 1, Line 5, Col 23, "This construct is deprecated. Property is obsolete") + (Error 101, Line 6, Col 1, Line 6, Col 20, "This construct is deprecated. Event is obsolete") ] diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/warn/nowarn_readonlystruct.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/warn/nowarn_readonlystruct.fs new file mode 100644 index 00000000000..2a4f0152709 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/warn/nowarn_readonlystruct.fs @@ -0,0 +1,9 @@ +// #Regression #NoMT #CompilerOptions +// See DevDiv:364238 +open System.Collections.Generic + +let x : IEnumerator> = failwith "" +printfn "%A" x.Current.Key // no defensive copy needed, because KeyValuePair is a "readonly struct" + +let y : list> = failwith "" // KeyValuePair +printfn "%A" y.[0].Key // no defensive copy needed, because KeyValuePair is a "readonly struct" diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/warn/warn_level5.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/warn/warn_level5.fs index d33dfcf9eec..2b6115e5718 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/warn/warn_level5.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/warn/warn_level5.fs @@ -2,8 +2,12 @@ // See DevDiv:364238 open System.Collections.Generic -let x : IEnumerator> = failwith "" -printfn "%A" x.Current.Key // defensive copy +[] +type NonReadOnlyStruct= + member val Property = "" with get, set -let y : list> = failwith "" -printfn "%A" y.[0].Key // defensive copy +let x : IEnumerator = failwith "" +printfn "%A" x.Current.Property // defensive copy + +let y : list = failwith "" // KeyValuePair +printfn "%A" y.[0].Property // defensive copy diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj index 19175fd7f05..202bd49532e 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj @@ -101,6 +101,9 @@ SyntaxTree\MemberFlagTests.fs + + SyntaxTree\MemberTests.fs + SyntaxTree\ComputationExpressionTests.fs @@ -116,6 +119,12 @@ SyntaxTree\SynIdentTests.fs + + SyntaxTree\AttributeTests.fs + + + SyntaxTree\ExternTests.fs + FileSystemTests.fs diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected b/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected index 736193358e7..1d2367fb0a6 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected @@ -3977,7 +3977,6 @@ FSharp.Compiler.EditorServices.ToolTipElementData FSharp.Compiler.EditorServices.ToolTipElementData: Boolean Equals(FSharp.Compiler.EditorServices.ToolTipElementData) FSharp.Compiler.EditorServices.ToolTipElementData: Boolean Equals(System.Object) FSharp.Compiler.EditorServices.ToolTipElementData: Boolean Equals(System.Object, System.Collections.IEqualityComparer) -FSharp.Compiler.EditorServices.ToolTipElementData: FSharp.Compiler.EditorServices.ToolTipElementData Create(FSharp.Compiler.Text.TaggedText[], FSharp.Compiler.Symbols.FSharpXmlDoc, Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Text.TaggedText[]]], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.TaggedText[]]) FSharp.Compiler.EditorServices.ToolTipElementData: FSharp.Compiler.Symbols.FSharpXmlDoc XmlDoc FSharp.Compiler.EditorServices.ToolTipElementData: FSharp.Compiler.Symbols.FSharpXmlDoc get_XmlDoc() FSharp.Compiler.EditorServices.ToolTipElementData: FSharp.Compiler.Text.TaggedText[] MainDescription @@ -5830,6 +5829,8 @@ FSharp.Compiler.Syntax.SynArgInfo: Microsoft.FSharp.Core.FSharpOption`1[FSharp.C FSharp.Compiler.Syntax.SynArgInfo: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident] ident FSharp.Compiler.Syntax.SynArgInfo: System.String ToString() FSharp.Compiler.Syntax.SynArgPats +FSharp.Compiler.Syntax.SynArgPats+NamePatPairs: FSharp.Compiler.SyntaxTrivia.SynArgPatsNamePatPairsTrivia get_trivia() +FSharp.Compiler.Syntax.SynArgPats+NamePatPairs: FSharp.Compiler.SyntaxTrivia.SynArgPatsNamePatPairsTrivia trivia FSharp.Compiler.Syntax.SynArgPats+NamePatPairs: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynArgPats+NamePatPairs: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynArgPats+NamePatPairs: Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`3[FSharp.Compiler.Syntax.Ident,FSharp.Compiler.Text.Range,FSharp.Compiler.Syntax.SynPat]] get_pats() @@ -5842,7 +5843,7 @@ FSharp.Compiler.Syntax.SynArgPats: Boolean IsNamePatPairs FSharp.Compiler.Syntax.SynArgPats: Boolean IsPats FSharp.Compiler.Syntax.SynArgPats: Boolean get_IsNamePatPairs() FSharp.Compiler.Syntax.SynArgPats: Boolean get_IsPats() -FSharp.Compiler.Syntax.SynArgPats: FSharp.Compiler.Syntax.SynArgPats NewNamePatPairs(Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`3[FSharp.Compiler.Syntax.Ident,FSharp.Compiler.Text.Range,FSharp.Compiler.Syntax.SynPat]], FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynArgPats: FSharp.Compiler.Syntax.SynArgPats NewNamePatPairs(Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`3[FSharp.Compiler.Syntax.Ident,FSharp.Compiler.Text.Range,FSharp.Compiler.Syntax.SynPat]], FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynArgPatsNamePatPairsTrivia) FSharp.Compiler.Syntax.SynArgPats: FSharp.Compiler.Syntax.SynArgPats NewPats(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynPat]) FSharp.Compiler.Syntax.SynArgPats: FSharp.Compiler.Syntax.SynArgPats+NamePatPairs FSharp.Compiler.Syntax.SynArgPats: FSharp.Compiler.Syntax.SynArgPats+Pats @@ -8003,6 +8004,14 @@ FSharp.Compiler.Syntax.SynPat+IsInst: FSharp.Compiler.Syntax.SynType get_pat() FSharp.Compiler.Syntax.SynPat+IsInst: FSharp.Compiler.Syntax.SynType pat FSharp.Compiler.Syntax.SynPat+IsInst: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynPat+IsInst: FSharp.Compiler.Text.Range range +FSharp.Compiler.Syntax.SynPat+ListCons: FSharp.Compiler.Syntax.SynPat get_lhsPat() +FSharp.Compiler.Syntax.SynPat+ListCons: FSharp.Compiler.Syntax.SynPat get_rhsPat() +FSharp.Compiler.Syntax.SynPat+ListCons: FSharp.Compiler.Syntax.SynPat lhsPat +FSharp.Compiler.Syntax.SynPat+ListCons: FSharp.Compiler.Syntax.SynPat rhsPat +FSharp.Compiler.Syntax.SynPat+ListCons: FSharp.Compiler.SyntaxTrivia.SynPatListConsTrivia get_trivia() +FSharp.Compiler.Syntax.SynPat+ListCons: FSharp.Compiler.SyntaxTrivia.SynPatListConsTrivia trivia +FSharp.Compiler.Syntax.SynPat+ListCons: FSharp.Compiler.Text.Range get_range() +FSharp.Compiler.Syntax.SynPat+ListCons: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynPat+LongIdent: FSharp.Compiler.Syntax.SynArgPats argPats FSharp.Compiler.Syntax.SynPat+LongIdent: FSharp.Compiler.Syntax.SynArgPats get_argPats() FSharp.Compiler.Syntax.SynPat+LongIdent: FSharp.Compiler.Syntax.SynLongIdent get_longDotId() @@ -8058,6 +8067,7 @@ FSharp.Compiler.Syntax.SynPat+Tags: Int32 DeprecatedCharRange FSharp.Compiler.Syntax.SynPat+Tags: Int32 FromParseError FSharp.Compiler.Syntax.SynPat+Tags: Int32 InstanceMember FSharp.Compiler.Syntax.SynPat+Tags: Int32 IsInst +FSharp.Compiler.Syntax.SynPat+Tags: Int32 ListCons FSharp.Compiler.Syntax.SynPat+Tags: Int32 LongIdent FSharp.Compiler.Syntax.SynPat+Tags: Int32 Named FSharp.Compiler.Syntax.SynPat+Tags: Int32 Null @@ -8092,6 +8102,7 @@ FSharp.Compiler.Syntax.SynPat: Boolean IsDeprecatedCharRange FSharp.Compiler.Syntax.SynPat: Boolean IsFromParseError FSharp.Compiler.Syntax.SynPat: Boolean IsInstanceMember FSharp.Compiler.Syntax.SynPat: Boolean IsIsInst +FSharp.Compiler.Syntax.SynPat: Boolean IsListCons FSharp.Compiler.Syntax.SynPat: Boolean IsLongIdent FSharp.Compiler.Syntax.SynPat: Boolean IsNamed FSharp.Compiler.Syntax.SynPat: Boolean IsNull @@ -8112,6 +8123,7 @@ FSharp.Compiler.Syntax.SynPat: Boolean get_IsDeprecatedCharRange() FSharp.Compiler.Syntax.SynPat: Boolean get_IsFromParseError() FSharp.Compiler.Syntax.SynPat: Boolean get_IsInstanceMember() FSharp.Compiler.Syntax.SynPat: Boolean get_IsIsInst() +FSharp.Compiler.Syntax.SynPat: Boolean get_IsListCons() FSharp.Compiler.Syntax.SynPat: Boolean get_IsLongIdent() FSharp.Compiler.Syntax.SynPat: Boolean get_IsNamed() FSharp.Compiler.Syntax.SynPat: Boolean get_IsNull() @@ -8132,6 +8144,7 @@ FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewDeprecatedCharRa FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewFromParseError(FSharp.Compiler.Syntax.SynPat, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewInstanceMember(FSharp.Compiler.Syntax.Ident, FSharp.Compiler.Syntax.Ident, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewIsInst(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewListCons(FSharp.Compiler.Syntax.SynPat, FSharp.Compiler.Syntax.SynPat, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynPatListConsTrivia) FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewLongIdent(FSharp.Compiler.Syntax.SynLongIdent, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynValTyparDecls], FSharp.Compiler.Syntax.SynArgPats, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewNamed(FSharp.Compiler.Syntax.SynIdent, Boolean, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewNull(FSharp.Compiler.Text.Range) @@ -8152,6 +8165,7 @@ FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat+DeprecatedCharRange FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat+FromParseError FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat+InstanceMember FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat+IsInst +FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat+ListCons FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat+LongIdent FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat+Named FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat+Null @@ -9396,15 +9410,22 @@ FSharp.Compiler.SyntaxTrivia.ParsedSigFileInputTrivia: Microsoft.FSharp.Collecti FSharp.Compiler.SyntaxTrivia.ParsedSigFileInputTrivia: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.SyntaxTrivia.ConditionalDirectiveTrivia] get_ConditionalDirectives() FSharp.Compiler.SyntaxTrivia.ParsedSigFileInputTrivia: System.String ToString() FSharp.Compiler.SyntaxTrivia.ParsedSigFileInputTrivia: Void .ctor(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.SyntaxTrivia.ConditionalDirectiveTrivia], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.SyntaxTrivia.CommentTrivia]) +FSharp.Compiler.SyntaxTrivia.SynArgPatsNamePatPairsTrivia +FSharp.Compiler.SyntaxTrivia.SynArgPatsNamePatPairsTrivia: FSharp.Compiler.Text.Range ParenRange +FSharp.Compiler.SyntaxTrivia.SynArgPatsNamePatPairsTrivia: FSharp.Compiler.Text.Range get_ParenRange() +FSharp.Compiler.SyntaxTrivia.SynArgPatsNamePatPairsTrivia: System.String ToString() +FSharp.Compiler.SyntaxTrivia.SynArgPatsNamePatPairsTrivia: Void .ctor(FSharp.Compiler.Text.Range) FSharp.Compiler.SyntaxTrivia.SynBindingTrivia FSharp.Compiler.SyntaxTrivia.SynBindingTrivia: FSharp.Compiler.SyntaxTrivia.SynBindingTrivia Zero FSharp.Compiler.SyntaxTrivia.SynBindingTrivia: FSharp.Compiler.SyntaxTrivia.SynBindingTrivia get_Zero() FSharp.Compiler.SyntaxTrivia.SynBindingTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] EqualsRange +FSharp.Compiler.SyntaxTrivia.SynBindingTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] ExternKeyword FSharp.Compiler.SyntaxTrivia.SynBindingTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] LetKeyword FSharp.Compiler.SyntaxTrivia.SynBindingTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_EqualsRange() +FSharp.Compiler.SyntaxTrivia.SynBindingTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_ExternKeyword() FSharp.Compiler.SyntaxTrivia.SynBindingTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_LetKeyword() FSharp.Compiler.SyntaxTrivia.SynBindingTrivia: System.String ToString() -FSharp.Compiler.SyntaxTrivia.SynBindingTrivia: Void .ctor(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range]) +FSharp.Compiler.SyntaxTrivia.SynBindingTrivia: Void .ctor(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range]) FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia: FSharp.Compiler.Text.Range EqualsRange FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia: FSharp.Compiler.Text.Range get_EqualsRange() @@ -9550,6 +9571,11 @@ FSharp.Compiler.SyntaxTrivia.SynModuleSigDeclNestedModuleTrivia: Microsoft.FShar FSharp.Compiler.SyntaxTrivia.SynModuleSigDeclNestedModuleTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_ModuleKeyword() FSharp.Compiler.SyntaxTrivia.SynModuleSigDeclNestedModuleTrivia: System.String ToString() FSharp.Compiler.SyntaxTrivia.SynModuleSigDeclNestedModuleTrivia: Void .ctor(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range]) +FSharp.Compiler.SyntaxTrivia.SynPatListConsTrivia +FSharp.Compiler.SyntaxTrivia.SynPatListConsTrivia: FSharp.Compiler.Text.Range ColonColonRange +FSharp.Compiler.SyntaxTrivia.SynPatListConsTrivia: FSharp.Compiler.Text.Range get_ColonColonRange() +FSharp.Compiler.SyntaxTrivia.SynPatListConsTrivia: System.String ToString() +FSharp.Compiler.SyntaxTrivia.SynPatListConsTrivia: Void .ctor(FSharp.Compiler.Text.Range) FSharp.Compiler.SyntaxTrivia.SynPatOrTrivia FSharp.Compiler.SyntaxTrivia.SynPatOrTrivia: FSharp.Compiler.Text.Range BarRange FSharp.Compiler.SyntaxTrivia.SynPatOrTrivia: FSharp.Compiler.Text.Range get_BarRange() @@ -9901,8 +9927,6 @@ FSharp.Compiler.Tokenization.FSharpKeywords: Microsoft.FSharp.Collections.FSharp FSharp.Compiler.Tokenization.FSharpKeywords: Microsoft.FSharp.Collections.FSharpList`1[System.String] get_KeywordNames() FSharp.Compiler.Tokenization.FSharpKeywords: Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[System.String,System.String]] KeywordsWithDescription FSharp.Compiler.Tokenization.FSharpKeywords: Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[System.String,System.String]] get_KeywordsWithDescription() -FSharp.Compiler.Tokenization.FSharpKeywords: System.Collections.Generic.IDictionary`2[System.String,System.String] KeywordsDescriptionLookup -FSharp.Compiler.Tokenization.FSharpKeywords: System.Collections.Generic.IDictionary`2[System.String,System.String] get_KeywordsDescriptionLookup() FSharp.Compiler.Tokenization.FSharpKeywords: System.String NormalizeIdentifierBackticks(System.String) FSharp.Compiler.Tokenization.FSharpLexer FSharp.Compiler.Tokenization.FSharpLexer: Void Tokenize(FSharp.Compiler.Text.ISourceText, Microsoft.FSharp.Core.FSharpFunc`2[FSharp.Compiler.Tokenization.FSharpToken,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.String]], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Tokenization.FSharpLexerFlags], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpMap`2[System.String,System.String]], Microsoft.FSharp.Core.FSharpOption`1[System.Threading.CancellationToken]) diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index 44cf37b3268..a43f9b08d89 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -2586,6 +2586,21 @@ module TypecheckTests = peverify cfg "pos40.exe" exec cfg ("." ++ "pos40.exe") "" + [] + let ``sigs pos1281`` () = + let cfg = testConfig "typecheck/sigs" + // This checks that warning 25 "incomplete matches" is not triggered + fsc cfg "%s --target:exe -o:pos1281.exe --warnaserror --nowarn:26" cfg.fsc_flags ["pos1281.fs"] + peverify cfg "pos1281.exe" + exec cfg ("." ++ "pos1281.exe") "" + + [] + let ``sigs pos3294`` () = + let cfg = testConfig "typecheck/sigs" + fsc cfg "%s --target:exe -o:pos3294.exe --warnaserror" cfg.fsc_flags ["pos3294.fs"] + peverify cfg "pos3294.exe" + exec cfg ("." ++ "pos3294.exe") "" + [] let ``sigs pos23`` () = let cfg = testConfig "typecheck/sigs" diff --git a/tests/fsharp/typecheck/sigs/neg20.bsl b/tests/fsharp/typecheck/sigs/neg20.bsl index 6fe2d2e3295..88f483967e4 100644 --- a/tests/fsharp/typecheck/sigs/neg20.bsl +++ b/tests/fsharp/typecheck/sigs/neg20.bsl @@ -271,7 +271,7 @@ neg20.fs(216,5,216,12): typecheck error FS0842: This attribute is not valid for neg20.fs(219,5,219,15): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(222,5,222,24): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(222,5,222,31): typecheck error FS0842: This attribute is not valid for use on this language element neg20.fs(225,5,225,22): typecheck error FS0842: This attribute is not valid for use on this language element @@ -289,9 +289,9 @@ neg20.fs(243,5,243,23): typecheck error FS0842: This attribute is not valid for neg20.fs(249,9,249,27): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(255,5,255,21): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(255,5,255,28): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(258,5,258,31): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(258,5,258,38): typecheck error FS0842: This attribute is not valid for use on this language element neg20.fs(261,5,261,17): typecheck error FS0842: This attribute is not valid for use on this language element @@ -299,7 +299,7 @@ neg20.fs(265,5,265,24): typecheck error FS0842: This attribute is not valid for neg20.fs(268,5,268,27): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(271,5,271,13): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(271,5,271,15): typecheck error FS0842: This attribute is not valid for use on this language element neg20.fs(278,14,278,95): typecheck error FS0507: No accessible member or object constructor named 'ProcessStartInfo' takes 0 arguments. Note the call to this member also provides 2 named arguments. diff --git a/tests/fsharp/typecheck/sigs/neg31.bsl b/tests/fsharp/typecheck/sigs/neg31.bsl index 86bb626f0b4..9140452d235 100644 --- a/tests/fsharp/typecheck/sigs/neg31.bsl +++ b/tests/fsharp/typecheck/sigs/neg31.bsl @@ -1,12 +1,12 @@ -neg31.fs(9,6,9,30): typecheck error FS1200: The attribute 'ObsoleteAttribute' appears in both the implementation and the signature, but the attribute arguments differ. Only the attribute from the signature will be included in the compiled code. +neg31.fs(9,6,9,64): typecheck error FS1200: The attribute 'ObsoleteAttribute' appears in both the implementation and the signature, but the attribute arguments differ. Only the attribute from the signature will be included in the compiled code. -neg31.fs(71,12,71,36): typecheck error FS1200: The attribute 'ObsoleteAttribute' appears in both the implementation and the signature, but the attribute arguments differ. Only the attribute from the signature will be included in the compiled code. +neg31.fs(71,12,71,70): typecheck error FS1200: The attribute 'ObsoleteAttribute' appears in both the implementation and the signature, but the attribute arguments differ. Only the attribute from the signature will be included in the compiled code. -neg31.fs(107,13,107,41): typecheck error FS1200: The attribute 'CLSCompliantAttribute' appears in both the implementation and the signature, but the attribute arguments differ. Only the attribute from the signature will be included in the compiled code. +neg31.fs(107,13,107,48): typecheck error FS1200: The attribute 'CLSCompliantAttribute' appears in both the implementation and the signature, but the attribute arguments differ. Only the attribute from the signature will be included in the compiled code. -neg31.fs(28,6,28,30): typecheck error FS1200: The attribute 'ObsoleteAttribute' appears in both the implementation and the signature, but the attribute arguments differ. Only the attribute from the signature will be included in the compiled code. +neg31.fs(28,6,28,64): typecheck error FS1200: The attribute 'ObsoleteAttribute' appears in both the implementation and the signature, but the attribute arguments differ. Only the attribute from the signature will be included in the compiled code. -neg31.fs(93,14,93,42): typecheck error FS1200: The attribute 'CLSCompliantAttribute' appears in both the implementation and the signature, but the attribute arguments differ. Only the attribute from the signature will be included in the compiled code. +neg31.fs(93,14,93,49): typecheck error FS1200: The attribute 'CLSCompliantAttribute' appears in both the implementation and the signature, but the attribute arguments differ. Only the attribute from the signature will be included in the compiled code. -neg31.fs(47,6,47,30): typecheck error FS1200: The attribute 'ObsoleteAttribute' appears in both the implementation and the signature, but the attribute arguments differ. Only the attribute from the signature will be included in the compiled code. +neg31.fs(47,6,47,64): typecheck error FS1200: The attribute 'ObsoleteAttribute' appears in both the implementation and the signature, but the attribute arguments differ. Only the attribute from the signature will be included in the compiled code. diff --git a/tests/fsharp/typecheck/sigs/neg32.bsl b/tests/fsharp/typecheck/sigs/neg32.bsl index 6afdd7ae5a7..be532860a7a 100644 --- a/tests/fsharp/typecheck/sigs/neg32.bsl +++ b/tests/fsharp/typecheck/sigs/neg32.bsl @@ -1,5 +1,5 @@ -neg32.fs(17,21,17,49): typecheck error FS0842: This attribute is not valid for use on this language element +neg32.fs(17,11,17,56): typecheck error FS0842: This attribute is not valid for use on this language element neg32.fs(24,15,24,16): typecheck error FS0043: The member or object constructor 'TryParse' does not take 1 argument(s). An overload was found taking 2 arguments. diff --git a/tests/fsharp/typecheck/sigs/pos1281.fs b/tests/fsharp/typecheck/sigs/pos1281.fs new file mode 100644 index 00000000000..f2a73c07c3d --- /dev/null +++ b/tests/fsharp/typecheck/sigs/pos1281.fs @@ -0,0 +1,17 @@ +module Pos1281 + +type Cond = Foo | Bar | Baz +let (|SetV|) x _ = x + +let c = Cond.Foo + +match c with +| Baz -> + printfn "Baz" +| Foo & SetV "and" kwd +| Bar & SetV "or" kwd -> + printfn "Keyword: %s" kwd +| Baz -> failwith "wat" + +printfn "test completed" +exit 0 diff --git a/tests/fsharp/typecheck/sigs/pos3294.fs b/tests/fsharp/typecheck/sigs/pos3294.fs new file mode 100644 index 00000000000..55fc5f2631b --- /dev/null +++ b/tests/fsharp/typecheck/sigs/pos3294.fs @@ -0,0 +1,8 @@ +module Pos40 + +let f = function + | [] -> 0 + | (_ :: _) & _ -> 0 + +printfn "test completed" +exit 0 diff --git a/tests/fsharp/typecheck/sigs/version50/neg20.bsl b/tests/fsharp/typecheck/sigs/version50/neg20.bsl index b1e3b87ffb5..37e8f71a499 100644 --- a/tests/fsharp/typecheck/sigs/version50/neg20.bsl +++ b/tests/fsharp/typecheck/sigs/version50/neg20.bsl @@ -319,7 +319,7 @@ neg20.fs(216,5,216,12): typecheck error FS0842: This attribute is not valid for neg20.fs(219,5,219,15): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(222,5,222,24): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(222,5,222,31): typecheck error FS0842: This attribute is not valid for use on this language element neg20.fs(225,5,225,22): typecheck error FS0842: This attribute is not valid for use on this language element @@ -337,9 +337,9 @@ neg20.fs(243,5,243,23): typecheck error FS0842: This attribute is not valid for neg20.fs(249,9,249,27): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(255,5,255,21): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(255,5,255,28): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(258,5,258,31): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(258,5,258,38): typecheck error FS0842: This attribute is not valid for use on this language element neg20.fs(261,5,261,17): typecheck error FS0842: This attribute is not valid for use on this language element @@ -347,7 +347,7 @@ neg20.fs(265,5,265,24): typecheck error FS0842: This attribute is not valid for neg20.fs(268,5,268,27): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(271,5,271,13): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(271,5,271,15): typecheck error FS0842: This attribute is not valid for use on this language element neg20.fs(278,14,278,95): typecheck error FS0507: No accessible member or object constructor named 'ProcessStartInfo' takes 0 arguments. Note the call to this member also provides 2 named arguments. diff --git a/tests/fsharpqa/Source/Conformance/Signatures/SignatureConformance/AttributeMatching01.fs b/tests/fsharpqa/Source/Conformance/Signatures/SignatureConformance/AttributeMatching01.fs index ceeadc93274..082ea859d45 100644 --- a/tests/fsharpqa/Source/Conformance/Signatures/SignatureConformance/AttributeMatching01.fs +++ b/tests/fsharpqa/Source/Conformance/Signatures/SignatureConformance/AttributeMatching01.fs @@ -1,6 +1,6 @@ // #Conformance #SignatureFiles #Attributes #Regression // Regression for 6446 - verifying spec matches implementation when fs/fsi files attributes differ -//The attribute 'ObsoleteAttribute' appears in both the implementation and the signature, but the attribute arguments differ\. Only the attribute from the signature will be included in the compiled code\. +//The attribute 'ObsoleteAttribute' appears in both the implementation and the signature, but the attribute arguments differ\. Only the attribute from the signature will be included in the compiled code\. module M diff --git a/tests/fsharpqa/Source/Conformance/Signatures/SignatureConformance/AttributeMatching01.fsi b/tests/fsharpqa/Source/Conformance/Signatures/SignatureConformance/AttributeMatching01.fsi index b3092d384b2..8f6e9113446 100644 --- a/tests/fsharpqa/Source/Conformance/Signatures/SignatureConformance/AttributeMatching01.fsi +++ b/tests/fsharpqa/Source/Conformance/Signatures/SignatureConformance/AttributeMatching01.fsi @@ -1,6 +1,6 @@ // #Conformance #SignatureFiles #Attributes #Regression // Regression for 6446 - verifying spec matches implementation when fs/fsi files attributes differ -//The attribute 'ObsoleteAttribute' appears in both the implementation and the signature, but the attribute arguments differ\. Only the attribute from the signature will be included in the compiled code\. +//The attribute 'ObsoleteAttribute' appears in both the implementation and the signature, but the attribute arguments differ\. Only the attribute from the signature will be included in the compiled code\. module M diff --git a/tests/fsharpqa/Source/Misc/E_CompiledName.fs b/tests/fsharpqa/Source/Misc/E_CompiledName.fs index cdf5e84ae72..437032e0112 100644 --- a/tests/fsharpqa/Source/Misc/E_CompiledName.fs +++ b/tests/fsharpqa/Source/Misc/E_CompiledName.fs @@ -1,8 +1,8 @@ // #Regression #Misc // Regression test for FSHARP1.0:5936 // This test ensures that you can't apply the CompiledName attribute more than once to a property -//The attribute type 'CompiledNameAttribute' has 'AllowMultiple=false'\. Multiple instances of this attribute cannot be attached to a single language element\.$ -//The attribute type 'CompiledNameAttribute' has 'AllowMultiple=false'\. Multiple instances of this attribute cannot be attached to a single language element\.$ +//The attribute type 'CompiledNameAttribute' has 'AllowMultiple=false'\. Multiple instances of this attribute cannot be attached to a single language element\.$ +//The attribute type 'CompiledNameAttribute' has 'AllowMultiple=false'\. Multiple instances of this attribute cannot be attached to a single language element\.$ module M type T() = diff --git a/tests/service/Common.fs b/tests/service/Common.fs index 7f2a8e56813..e19ed1f1c49 100644 --- a/tests/service/Common.fs +++ b/tests/service/Common.fs @@ -232,6 +232,11 @@ let getSingleParenInnerExpr expr = | SynModuleDecl.Expr(SynExpr.Paren(expr, _, _, _), _) -> expr | _ -> failwith "Unexpected tree" +let getLetDeclHeadPattern (moduleDecl: SynModuleDecl) = + match moduleDecl with + | SynModuleDecl.Let(_, [SynBinding(headPat = pat)], _) -> pat + | _ -> failwith "Unexpected tree" + let parseSourceCodeAndGetModule (source: string) = parseSourceCode ("test.fsx", source) |> getSingleModuleLikeDecl @@ -458,7 +463,7 @@ let coreLibAssemblyName = "mscorlib" #endif -let getRange (e: SynExpr) = e.Range +let inline getRange (node: ^T) = (^T: (member Range: range) node) let assertRange (expectedStartLine: int, expectedStartColumn: int) diff --git a/tests/service/ParserTests.fs b/tests/service/ParserTests.fs index b96083b77e7..cc4a9923ab7 100644 --- a/tests/service/ParserTests.fs +++ b/tests/service/ParserTests.fs @@ -131,9 +131,7 @@ match () with match getSingleExprInModule parseResults with | SynExpr.Match (clauses=[ SynMatchClause (pat=pat) ]) -> match pat with - | SynPat.Or - (SynPat.FromParseError (SynPat.Paren (SynPat.FromParseError (SynPat.Wild _, _), _), _), - SynPat.Named _, _, _) -> () + | SynPat.Paren(SynPat.Or(SynPat.Tuple(_, [SynPat.Named _; SynPat.Wild _], _), SynPat.Named _, _, _), _) -> () | _ -> failwith "Unexpected pattern" | _ -> failwith "Unexpected tree" @@ -185,7 +183,7 @@ let f (x, match getSingleDeclInModule parseResults with | SynModuleDecl.Let (_, [ SynBinding (headPat = SynPat.LongIdent (argPats = SynArgPats.Pats [ pat ])) ], _) -> match pat with - | SynPat.FromParseError (SynPat.Paren (SynPat.FromParseError (SynPat.Wild _, _), _), _) -> () + | SynPat.FromParseError (SynPat.Paren (SynPat.Tuple(_, [SynPat.Named _; SynPat.Wild _], _), _), _) -> () | _ -> failwith "Unexpected tree" | _ -> failwith "Unexpected tree" @@ -194,7 +192,11 @@ let assertIsBefore (f: _ -> range) (a, b) = let r2 = f b Position.posGeq r2.Start r1.End |> shouldEqual true -let checkExprOrder exprs = +let inline assertIsEmptyRange node = + let range = getRange node + Position.posEq range.Start range.End |> shouldEqual true + +let inline checkNodeOrder exprs = exprs |> List.pairwise |> List.iter (assertIsBefore getRange) @@ -220,7 +222,7 @@ let ``Expr - Tuple 01`` () = | [ SynExpr.Tuple(_, [SynExpr.ArbitraryAfterError _ as e11; SynExpr.ArbitraryAfterError _ as e12], c1, _) SynExpr.Tuple(_, [SynExpr.ArbitraryAfterError _ as e21; SynExpr.ArbitraryAfterError _ as e22; SynExpr.ArbitraryAfterError _ as e23], c2, _) SynExpr.Tuple(_, [SynExpr.ArbitraryAfterError _ as e31; SynExpr.ArbitraryAfterError _ as e32; SynExpr.ArbitraryAfterError _ as e33; SynExpr.ArbitraryAfterError _ as e34], c3, _) ] -> - [ e11; e12; e21; e22; e23; e31; e32; e33; e34 ] |> checkExprOrder + [ e11; e12; e21; e22; e23; e31; e32; e33; e34 ] |> checkNodeOrder [ c1, 1; c2, 2; c3, 3 ] |> checkRangeCountAndOrder | _ -> failwith "Unexpected tree" @@ -237,7 +239,7 @@ let ``Expr - Tuple 02`` () = | [ SynExpr.Tuple(_, [SynExpr.Const _ as e11; SynExpr.ArbitraryAfterError _ as e12], c1, _) SynExpr.Tuple(_, [SynExpr.ArbitraryAfterError _ as e21; SynExpr.Const _ as e22], c2, _) SynExpr.Tuple(_, [SynExpr.Const _ as e31; SynExpr.Const _ as e32], c3, _) ] -> - [ e11; e12; e21; e22; e31; e32 ] |> checkExprOrder + [ e11; e12; e21; e22; e31; e32 ] |> checkNodeOrder [ c1, 1; c2, 1; c3, 1 ] |> checkRangeCountAndOrder | _ -> failwith "Unexpected tree" @@ -269,7 +271,7 @@ let ``Expr - Tuple 03`` () = [ e11; e12; e13; e21; e22; e23; e31; e32; e33 e41; e42; e43; e51; e52; e53; e61; e62; e63 e71; e72; e73 ] - |> checkExprOrder + |> checkNodeOrder [ c1, 2; c2, 2; c3, 2 c4, 2; c5, 2; c6, 2 @@ -294,9 +296,7 @@ let ``Expr - Tuple 04`` () = SynExpr.ArbitraryAfterError _ as e6 SynExpr.Const _ as e7 SynExpr.ArbitraryAfterError _ as e8 ], c, _) ] -> - [ e1; e2; e3; e4; e5; e6; e7; e8 ] - |> checkExprOrder - + [ e1; e2; e3; e4; e5; e6; e7; e8 ] |> checkNodeOrder [ c, 7 ] |> checkRangeCountAndOrder | _ -> failwith "Unexpected tree" @@ -333,3 +333,138 @@ let x = 1, shouldEqual expr.Range.StartLine expr.Range.EndLine shouldEqual range.StartLine range.EndLine | _ -> failwith "Unexpected tree" + +[] +let ``Pattern - Head - Tuple 01`` () = + let parseResults = getParseResults """ +let , = () +let ,, = () +let ,,, = () +""" + let pats = getSingleModuleMemberDecls parseResults |> List.map getLetDeclHeadPattern + match pats with + | [ SynPat.Tuple(_, [SynPat.Wild _ as p11; SynPat.Wild _ as p12], _) + SynPat.Tuple(_, [SynPat.Wild _ as p21; SynPat.Wild _ as p22; SynPat.Wild _ as p23], _) + SynPat.Tuple(_, [SynPat.Wild _ as p31; SynPat.Wild _ as p32; SynPat.Wild _ as p33; SynPat.Wild _ as p34], _) ] -> + [ p11; p12; p21; p22; p23; p31; p32; p33; p34 ] |> checkNodeOrder + [ p11; p12; p21; p22; p23; p31; p32; p33; p34 ] |> List.iter assertIsEmptyRange + + | _ -> failwith "Unexpected tree" + +[] +let ``Pattern - Head - Tuple 02`` () = + let parseResults = getParseResults """ +let 1, = () +let ,1 = () +let 1,1 = () +""" + let pats = getSingleModuleMemberDecls parseResults |> List.map getLetDeclHeadPattern + match pats with + | [ SynPat.Tuple(_, [SynPat.Const _ as p11; SynPat.Wild _ as p12], _) + SynPat.Tuple(_, [SynPat.Wild _ as p21; SynPat.Const _ as p22], _) + SynPat.Tuple(_, [SynPat.Const _ as p31; SynPat.Const _ as p32], _) ] -> + [ p11; p12; p21; p22; p31; p32 ] |> checkNodeOrder + [ p12; p21 ] |> List.iter assertIsEmptyRange + + | _ -> failwith "Unexpected tree" + +[] +let ``Pattern - Head - Tuple 03`` () = + let parseResults = getParseResults """ +let 1,, = () +let ,1, = () +let ,,1 = () + +let 1,1, = () +let ,1,1 = () +let 1,,1 = () + +let 1,1,1 = () +""" + let pats = getSingleModuleMemberDecls parseResults |> List.map getLetDeclHeadPattern + match pats with + | [ SynPat.Tuple(_, [SynPat.Const _ as p11; SynPat.Wild _ as p12; SynPat.Wild _ as p13], _) + SynPat.Tuple(_, [SynPat.Wild _ as p21; SynPat.Const _ as p22; SynPat.Wild _ as p23], _) + SynPat.Tuple(_, [SynPat.Wild _ as p31; SynPat.Wild _ as p32; SynPat.Const _ as p33], _) + + SynPat.Tuple(_, [SynPat.Const _ as p41; SynPat.Const _ as p42; SynPat.Wild _ as p43], _) + SynPat.Tuple(_, [SynPat.Wild _ as p51; SynPat.Const _ as p52; SynPat.Const _ as p53], _) + SynPat.Tuple(_, [SynPat.Const _ as p61; SynPat.Wild _ as p62; SynPat.Const _ as p63], _) + + SynPat.Tuple(_, [SynPat.Const _ as p71; SynPat.Const _ as p72; SynPat.Const _ as p73], _) ] -> + [ p11; p12; p13; p21; p22; p23; p31; p32; p33 + p41; p42; p43; p51; p52; p53; p61; p62; p63 + p71; p72; p73 ] |> checkNodeOrder + [ p12; p13; p21; p23; p31; p32; p43; p51; p62 ] |> List.iter assertIsEmptyRange + + | _ -> failwith "Unexpected tree" + +let getParenPatInnerPattern pat = + match pat with + | SynPat.Paren(pat, _) -> pat + | _ -> failwith "Unexpected tree" + +[] +let ``Pattern - Paren - Tuple 01`` () = + let parseResults = getParseResults """ +let (,) = () +let (,,) = () +let (,,,) = () +""" + let pats = getSingleModuleMemberDecls parseResults |> List.map (getLetDeclHeadPattern >> getParenPatInnerPattern) + match pats with + | [ SynPat.Tuple(_, [SynPat.Wild _ as p11; SynPat.Wild _ as p12], _) + SynPat.Tuple(_, [SynPat.Wild _ as p21; SynPat.Wild _ as p22; SynPat.Wild _ as p23], _) + SynPat.Tuple(_, [SynPat.Wild _ as p31; SynPat.Wild _ as p32; SynPat.Wild _ as p33; SynPat.Wild _ as p34], _) ] -> + [ p11; p12; p21; p22; p23; p31; p32; p33; p34 ] |> checkNodeOrder + [ p11; p12; p21; p22; p23; p31; p32; p33; p34 ] |> List.iter assertIsEmptyRange + + | _ -> failwith "Unexpected tree" + +[] +let ``Pattern - Paren - Tuple 02`` () = + let parseResults = getParseResults """ +let (1,) = () +let (,1) = () +let (1,1) = () +""" + let pats = getSingleModuleMemberDecls parseResults |> List.map (getLetDeclHeadPattern >> getParenPatInnerPattern) + match pats with + | [ SynPat.Tuple(_, [SynPat.Const _ as p11; SynPat.Wild _ as p12], _) + SynPat.Tuple(_, [SynPat.Wild _ as p21; SynPat.Const _ as p22], _) + SynPat.Tuple(_, [SynPat.Const _ as p31; SynPat.Const _ as p32], _) ] -> + [ p11; p12; p21; p22; p31; p32 ] |> checkNodeOrder + [ p12; p21 ] |> List.iter assertIsEmptyRange + + | _ -> failwith "Unexpected tree" + +[] +let ``Pattern - Paren - Tuple 03`` () = + let parseResults = getParseResults """ +let (1,,) = () +let (,1,) = () +let (,,1) = () + +let (1,1,) = () +let (,1,1) = () +let (1,,1) = () + +let (1,1,1) = () +""" + let pats = getSingleModuleMemberDecls parseResults |> List.map (getLetDeclHeadPattern >> getParenPatInnerPattern) + match pats with + | [ SynPat.Tuple(_, [SynPat.Const _ as p11; SynPat.Wild _ as p12; SynPat.Wild _ as p13], _) + SynPat.Tuple(_, [SynPat.Wild _ as p21; SynPat.Const _ as p22; SynPat.Wild _ as p23], _) + SynPat.Tuple(_, [SynPat.Wild _ as p31; SynPat.Wild _ as p32; SynPat.Const _ as p33], _) + + SynPat.Tuple(_, [SynPat.Const _ as p41; SynPat.Const _ as p42; SynPat.Wild _ as p43], _) + SynPat.Tuple(_, [SynPat.Wild _ as p51; SynPat.Const _ as p52; SynPat.Const _ as p53], _) + SynPat.Tuple(_, [SynPat.Const _ as p61; SynPat.Wild _ as p62; SynPat.Const _ as p63], _) + + SynPat.Tuple(_, [SynPat.Const _ as p71; SynPat.Const _ as p72; SynPat.Const _ as p73], _) ] -> + [ p11; p12; p13; p21; p22; p23; p31; p32; p33 + p41; p42; p43; p51; p52; p53; p61; p62; p63 + p71; p72; p73 ] |> checkNodeOrder + [ p12; p13; p21; p23; p31; p32; p43; p51; p62 ] |> List.iter assertIsEmptyRange + + | _ -> failwith "Unexpected tree" diff --git a/tests/service/PatternMatchCompilationTests.fs b/tests/service/PatternMatchCompilationTests.fs index 4e56b7672e2..49117c04cea 100644 --- a/tests/service/PatternMatchCompilationTests.fs +++ b/tests/service/PatternMatchCompilationTests.fs @@ -46,7 +46,7 @@ match () with assertHasSymbolUsages ["x"; "y"; "CompiledNameAttribute"] checkResults dumpDiagnostics checkResults |> shouldEqual [ "(3,2--3,25): Attributes are not allowed within patterns" - "(3,4--3,16): This attribute is not valid for use on this language element" + "(3,4--3,23): This attribute is not valid for use on this language element" ] @@ -81,26 +81,6 @@ match 1, 2 with ] -[] -#if !NETCOREAPP -[] -#endif -let ``Union case 01 - Missing field`` () = - let _, checkResults = getParseAndCheckResults """ -type U = - | A - | B of int * int * int - -match A with -| B (x, _) -> let y = x + 1 in () -""" - assertHasSymbolUsages ["x"; "y"] checkResults - dumpDiagnostics checkResults |> shouldEqual [ - "(7,2--7,10): This union case expects 3 arguments in tupled form" - "(6,6--6,7): Incomplete pattern matches on this expression. For example, the value 'A' may indicate a case not covered by the pattern(s)." - ] - - [] #if !NETCOREAPP [] @@ -197,47 +177,6 @@ match A with "(6,6--6,7): Incomplete pattern matches on this expression. For example, the value 'A' may indicate a case not covered by the pattern(s)." ] - -[] -#if !NETCOREAPP -[] -#endif -let ``Union case 07 - Named args - Name used twice`` () = - let _, checkResults = getParseAndCheckResults """ -type U = - | A - | B of field: int * int - -match A with -| B (field = x; field = z) -> let y = x + z + 1 in () -""" - assertHasSymbolUsages ["x"; "y"; "z"] checkResults - dumpDiagnostics checkResults |> shouldEqual [ - "(7,16--7,21): Union case/exception field 'field' cannot be used more than once." - "(6,6--6,7): Incomplete pattern matches on this expression. For example, the value 'A' may indicate a case not covered by the pattern(s)." - ] - - -[] -#if !NETCOREAPP -[] -#endif -let ``Union case 08 - Multiple tupled args`` () = - let _, checkResults = getParseAndCheckResults """ -type U = - | A - | B of field: int * int - -match A with -| B x z -> let y = x + z + 1 in () -""" - assertHasSymbolUsages ["x"; "y"; "z"] checkResults - dumpDiagnostics checkResults |> shouldEqual [ - "(7,2--7,7): This union case expects 2 arguments in tupled form" - "(6,6--6,7): Incomplete pattern matches on this expression. For example, the value 'A' may indicate a case not covered by the pattern(s)." - ] - - [] let ``Union case 09 - Single arg`` () = let _, checkResults = getParseAndCheckResults """ @@ -249,7 +188,6 @@ match None with dumpDiagnostics checkResults |> shouldEqual [ ] - [] #if !NETCOREAPP [] @@ -781,6 +719,7 @@ let z as = """ dumpDiagnostics checkResults |> shouldEqual [ "(10,7--10,9): Unexpected keyword 'as' in binding" + "(10,5--10,6): Expecting pattern" "(11,10--11,12): Unexpected keyword 'as' in binding. Expected '=' or other token." "(12,9--12,11): Unexpected keyword 'as' in binding" "(13,8--13,10): Unexpected keyword 'as' in binding" @@ -801,6 +740,7 @@ let z as = "(6,4--6,10): This runtime coercion or type test from type 'a to int involves an indeterminate type based on information prior to this program point. Runtime type tests are not allowed on some types. Further type annotations are needed." "(8,29--8,30): This expression was expected to have type 'unit' but here has type 'int'" "(9,26--9,27): This expression was expected to have type 'unit' but here has type 'int'" + "(10,14--10,15): This expression was expected to have type ''a * 'b' but here has type 'int'" "(15,4--15,5): The pattern discriminator 'r' is not defined." "(15,4--15,12): Incomplete pattern matches on this expression." ] @@ -1182,6 +1122,7 @@ let as :? z = """ dumpDiagnostics checkResults |> shouldEqual [ "(10,7--10,9): Unexpected keyword 'as' in binding" + "(10,5--10,6): Expecting pattern" "(11,10--11,12): Unexpected keyword 'as' in binding. Expected '=' or other token." "(12,9--12,11): Unexpected keyword 'as' in binding" "(13,8--13,10): Unexpected keyword 'as' in binding" @@ -1209,6 +1150,8 @@ let as :? z = "(8,25--8,29): The type 'unit' does not have any proper subtypes and cannot be used as the source of a type test or runtime coercion." "(9,25--9,26): The type 'g' is not defined." "(9,22--9,26): The type 'unit' does not have any proper subtypes and cannot be used as the source of a type test or runtime coercion." + "(10,13--10,14): The type 'i' is not defined." + "(10,10--10,14): The type ''a * 'b' does not have any proper subtypes and cannot be used as the source of a type test or runtime coercion." "(16,4--16,5): The pattern discriminator 't' is not defined." "(16,14--16,15): The type 'u' is not defined." "(16,11--16,15): This runtime coercion or type test from type 'a to 'b involves an indeterminate type based on information prior to this program point. Runtime type tests are not allowed on some types. Further type annotations are needed." diff --git a/tests/service/SyntaxTreeTests/AttributeTests.fs b/tests/service/SyntaxTreeTests/AttributeTests.fs new file mode 100644 index 00000000000..c31aefae85f --- /dev/null +++ b/tests/service/SyntaxTreeTests/AttributeTests.fs @@ -0,0 +1,50 @@ +module FSharp.Compiler.Service.Tests.SyntaxTreeTests.AttributeTests + +open FSharp.Compiler.Service.Tests.Common +open FSharp.Compiler.Syntax +open NUnit.Framework + +[] +let ``range of attribute`` () = + let ast = + """ +[] +do () +""" + |> getParseResults + + match ast with + | ParsedInput.ImplFile (ParsedImplFileInput(contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = + [ SynModuleDecl.Attributes(attributes = [ { Attributes = [ { Range = mAttribute } ] } ]) ; SynModuleDecl.Expr _ ] ) ])) -> + assertRange (2, 2) (2, 25) mAttribute + | _ -> Assert.Fail $"Could not get valid AST, got {ast}" + +[] +let ``range of attribute with path`` () = + let ast = + """ +[] +do () +""" + |> getParseResults + + match ast with + | ParsedInput.ImplFile (ParsedImplFileInput(contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = + [ SynModuleDecl.Attributes(attributes = [ { Attributes = [ { Range = mAttribute } ] } ]) ; SynModuleDecl.Expr _ ] ) ])) -> + assertRange (2, 2) (2, 32) mAttribute + | _ -> Assert.Fail $"Could not get valid AST, got {ast}" + +[] +let ``range of attribute with target`` () = + let ast = + """ +[] +do () +""" + |> getParseResults + + match ast with + | ParsedInput.ImplFile (ParsedImplFileInput(contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = + [ SynModuleDecl.Attributes(attributes = [ { Attributes = [ { Range = mAttribute } ] } ]) ; SynModuleDecl.Expr _ ] ) ])) -> + assertRange (2, 2) (2, 35) mAttribute + | _ -> Assert.Fail $"Could not get valid AST, got {ast}" diff --git a/tests/service/SyntaxTreeTests/ExternTests.fs b/tests/service/SyntaxTreeTests/ExternTests.fs new file mode 100644 index 00000000000..0599307d994 --- /dev/null +++ b/tests/service/SyntaxTreeTests/ExternTests.fs @@ -0,0 +1,21 @@ +module FSharp.Compiler.Service.Tests.SyntaxTreeTests.ExternTests + +open FSharp.Compiler.Service.Tests.Common +open FSharp.Compiler.Syntax +open FSharp.Compiler.SyntaxTrivia +open NUnit.Framework + +[] +let ``extern keyword is present in trivia`` () = + let parseResults = getParseResults "extern void GetProcessHeap()" + + match parseResults with + | ParsedInput.ImplFile(ParsedImplFileInput(contents = [ + SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Let(bindings = [ + SynBinding(trivia = { ExternKeyword = Some mExtern }) + ]) + ]) + ])) -> + assertRange (1, 0) (1, 6) mExtern + | _ -> Assert.Fail $"Could not get valid AST, got {parseResults}" diff --git a/tests/service/SyntaxTreeTests/MemberTests.fs b/tests/service/SyntaxTreeTests/MemberTests.fs new file mode 100644 index 00000000000..084af4bff85 --- /dev/null +++ b/tests/service/SyntaxTreeTests/MemberTests.fs @@ -0,0 +1,225 @@ +module FSharp.Compiler.Service.Tests.SyntaxTreeTests.MemberTests + +open FSharp.Compiler.Service.Tests.Common +open FSharp.Compiler.Syntax +open FSharp.Compiler.SyntaxTrivia +open NUnit.Framework + +[] +let ``SynTypeDefn with AutoProperty contains the range of the equals sign`` () = + let parseResults = + getParseResults + """ +/// mutable class with auto-properties +type Person(name : string, age : int) = + /// Full name + member val Name = name with get, set +""" + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Types( + typeDefns = [ SynTypeDefn(typeRepr = SynTypeDefnRepr.ObjectModel(members = [_ ; SynMemberDefn.AutoProperty(equalsRange = mEquals)])) ] + ) + ]) ])) -> + assertRange (5, 20) (5, 21) mEquals + | _ -> Assert.Fail "Could not get valid AST" + +[] +let ``SynTypeDefn with AutoProperty contains the range of the with keyword`` () = + let parseResults = + getParseResults + """ +type Foo() = + member val AutoProperty = autoProp with get, set + member val AutoProperty2 = autoProp +""" + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Types( + typeDefns = [ SynTypeDefn(typeRepr = SynTypeDefnRepr.ObjectModel(members = [_ + SynMemberDefn.AutoProperty(withKeyword=Some mWith) + SynMemberDefn.AutoProperty(withKeyword=None)])) ] + ) + ]) ])) -> + assertRange (3, 39) (3, 43) mWith + | _ -> Assert.Fail "Could not get valid AST" + +[] +let ``SynTypeDefn with AbstractSlot contains the range of the with keyword`` () = + let parseResults = + getParseResults + """ +type Foo() = + abstract member Bar : int with get,set +""" + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Types( + typeDefns = [ SynTypeDefn(typeRepr = SynTypeDefnRepr.ObjectModel(members = [_ + SynMemberDefn.AbstractSlot(slotSig=SynValSig(trivia = { WithKeyword = Some mWith }))])) ] + ) + ]) ])) -> + assertRange (3, 30) (3, 34) mWith + | _ -> Assert.Fail "Could not get valid AST" + +[] +let ``read-only property in SynMemberDefn.Member contains the range of the with keyword`` () = + let parseResults = + getParseResults + """ +type Foo() = + // A read-only property. + member this.MyReadProperty with get () = myInternalValue +""" + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Types( + typeDefns = [ SynTypeDefn(typeRepr = + SynTypeDefnRepr.ObjectModel(members=[ + _ + SynMemberDefn.GetSetMember(Some(SynBinding _), None, _, { WithKeyword = mWith }) ]) + ) ]) + ]) ])) -> + assertRange (4, 31) (4, 35) mWith + | _ -> Assert.Fail "Could not get valid AST" + +[] +let ``write-only property in SynMemberDefn.Member contains the range of the with keyword`` () = + let parseResults = + getParseResults + """ +type Foo() = + // A write-only property. + member this.MyWriteOnlyProperty with set (value) = myInternalValue <- value +""" + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Types( + typeDefns = [ SynTypeDefn(typeRepr = + SynTypeDefnRepr.ObjectModel(members=[ + _ + SynMemberDefn.GetSetMember(None, Some(SynBinding _), _, { WithKeyword = mWith }) ]) + ) ]) + ]) ])) -> + assertRange (4, 36) (4, 40) mWith + | _ -> Assert.Fail "Could not get valid AST" + +[] +let ``read/write property in SynMemberDefn.Member contains the range of the with keyword`` () = + let parseResults = + getParseResults + """ +type Foo() = + // A read-write property. + member this.MyReadWriteProperty + with get () = myInternalValue + and set (value) = myInternalValue <- value +""" + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Types( + typeDefns = [ SynTypeDefn(typeRepr = + SynTypeDefnRepr.ObjectModel(members=[ + _ + SynMemberDefn.GetSetMember(Some _, Some _, _, { WithKeyword = mWith; AndKeyword = Some mAnd }) ]) + ) ]) + ]) ])) -> + assertRange (5, 8) (5, 12) mWith + assertRange (6, 8) (6, 11) mAnd + | _ -> Assert.Fail "Could not get valid AST" + +[] +let ``SynTypeDefn with static member with get/set`` () = + let parseResults = + getParseResults + """ +type Foo = + static member ReadWrite2 + with set x = lastUsed <- ("ReadWrite2", x) + and get () = lastUsed <- ("ReadWrite2", 0); 4 +""" + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Types( + typeDefns = [ SynTypeDefn(typeRepr = SynTypeDefnRepr.ObjectModel(members = [ + SynMemberDefn.GetSetMember(Some _, Some _, m, { WithKeyword = mWith + GetKeyword = Some mGet + AndKeyword = Some mAnd + SetKeyword = Some mSet }) + ])) ] + ) + ]) ])) -> + assertRange (4, 8) (4, 12) mWith + assertRange (4, 13) (4, 16) mSet + assertRange (5, 8) (5, 11) mAnd + assertRange (5, 13) (5, 16) mGet + assertRange (3, 4) (5, 54) m + | _ -> Assert.Fail "Could not get valid AST" + +[] +let ``SynTypeDefn with member with set/get`` () = + let parseResults = + getParseResults + """ +type A() = + member this.Z with set (_:int):unit = () and get():int = 1 +""" + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Types( + typeDefns = [ SynTypeDefn(typeRepr = SynTypeDefnRepr.ObjectModel(members = [ + SynMemberDefn.ImplicitCtor _ + SynMemberDefn.GetSetMember(Some (SynBinding(headPat = SynPat.LongIdent(extraId = Some getIdent))), + Some (SynBinding(headPat = SynPat.LongIdent(extraId = Some setIdent))), + m, + { WithKeyword = mWith + GetKeyword = Some mGet + AndKeyword = Some mAnd + SetKeyword = Some mSet }) + ])) ] + ) + ]) ])) -> + Assert.AreEqual("get", getIdent.idText) + Assert.AreEqual("set", setIdent.idText) + assertRange (3, 18) (3, 22) mWith + assertRange (3, 23) (3, 26) mSet + assertRange (3, 23) (3, 26) setIdent.idRange + assertRange (3, 45) (3, 48) mAnd + assertRange (3, 49) (3, 52) mGet + assertRange (3, 49) (3, 52) getIdent.idRange + assertRange (3, 4) (3, 62) m + | _ -> Assert.Fail "Could not get valid AST" + +[] +let ``SynTypeDefn with member with get has xml comment`` () = + let parseResults = + getParseResults + """ +type A = + /// B + member x.B with get() = 5 +""" + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Types( + typeDefns = [ SynTypeDefn(typeRepr = SynTypeDefnRepr.ObjectModel(members = [ + SynMemberDefn.GetSetMember(Some (SynBinding(xmlDoc = preXmlDoc)), + None, + _, + _) + ])) ] + ) + ]) ])) -> + Assert.False preXmlDoc.IsEmpty + let comment = preXmlDoc.ToXmlDoc(false, None).GetXmlText() + Assert.False (System.String.IsNullOrWhiteSpace(comment)) + | _ -> Assert.Fail "Could not get valid AST" diff --git a/tests/service/SyntaxTreeTests/PatternTests.fs b/tests/service/SyntaxTreeTests/PatternTests.fs index 61a511dc88a..c03325e6077 100644 --- a/tests/service/SyntaxTreeTests/PatternTests.fs +++ b/tests/service/SyntaxTreeTests/PatternTests.fs @@ -73,10 +73,10 @@ let (head::tail) = [ 1;2;4] match parseResults with | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ SynModuleDecl.Let( - bindings = [ SynBinding(headPat = SynPat.Paren(SynPat.LongIdent(longDotId = SynLongIdent([ opColonColonIdent ], _, [ Some (IdentTrivia.OriginalNotation "::") ])), _)) ] + bindings = [ SynBinding(headPat = SynPat.Paren(pat = SynPat.ListCons(trivia = trivia))) ] ) ]) ])) -> - Assert.AreEqual("op_ColonColon", opColonColonIdent.idText) + assertRange (2,9) (2,11) trivia.ColonColonRange | _ -> Assert.Fail $"Could not get valid AST, got {parseResults}" [] @@ -92,9 +92,49 @@ match x with | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ SynModuleDecl.Expr( expr = SynExpr.Match(clauses = [ - SynMatchClause(pat = SynPat.LongIdent(longDotId = SynLongIdent([ opColonColonIdent ], _, [ Some (IdentTrivia.OriginalNotation "::") ]))) + SynMatchClause(pat = SynPat.ListCons(trivia = trivia)) ]) ) ]) ])) -> - Assert.AreEqual("op_ColonColon", opColonColonIdent.idText) - | _ -> Assert.Fail $"Could not get valid AST, got {parseResults}" \ No newline at end of file + assertRange (3, 9) (3, 11) trivia.ColonColonRange + | _ -> Assert.Fail $"Could not get valid AST, got {parseResults}" + +[] +let ``Parentheses of SynArgPats.NamePatPairs`` () = + let parseResults = + getParseResults + """ +match data with +| OnePartData( // foo + part1 = p1 + (* bar *) ) -> p1 +| _ -> failwith "todo" +""" + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Expr( + expr = SynExpr.Match(clauses = [ + SynMatchClause(pat = SynPat.LongIdent(argPats = SynArgPats.NamePatPairs(trivia = trivia))) + _ + ]) + ) + ]) ])) -> + assertRange (3, 13) (5, 13) trivia.ParenRange + | _ -> Assert.Fail $"Could not get valid AST, got {parseResults}" + +[] +let ``:: in head pattern`` () = + let parseResults = + getParseResults + """ +let 1 :: _ = [ 4; 5; 6 ] +""" + + match parseResults with + | ParsedInput.ImplFile(ParsedImplFileInput(contents = [ SynModuleOrNamespace(decls = [ + SynModuleDecl.Let(bindings = [ SynBinding(headPat = + SynPat.ListCons(trivia = trivia)) ]) + ]) ])) -> + assertRange (2,6) (2, 8) trivia.ColonColonRange + | _ -> Assert.Fail $"Could not get valid AST, got {parseResults}" diff --git a/tests/service/SyntaxTreeTests/TypeTests.fs b/tests/service/SyntaxTreeTests/TypeTests.fs index 874c1f41dac..c006a7cd529 100644 --- a/tests/service/SyntaxTreeTests/TypeTests.fs +++ b/tests/service/SyntaxTreeTests/TypeTests.fs @@ -169,26 +169,6 @@ type Shape = assertRange (2, 11) (2, 12) mEquals | _ -> Assert.Fail "Could not get valid AST" -[] -let ``SynTypeDefn with AutoProperty contains the range of the equals sign`` () = - let parseResults = - getParseResults - """ -/// mutable class with auto-properties -type Person(name : string, age : int) = - /// Full name - member val Name = name with get, set -""" - - match parseResults with - | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ - SynModuleDecl.Types( - typeDefns = [ SynTypeDefn(typeRepr = SynTypeDefnRepr.ObjectModel(members = [_ ; SynMemberDefn.AutoProperty(equalsRange = mEquals)])) ] - ) - ]) ])) -> - assertRange (5, 20) (5, 21) mEquals - | _ -> Assert.Fail "Could not get valid AST" - [] let ``SynTypeDefn with Record contains the range of the with keyword`` () = let parseResults = @@ -250,115 +230,6 @@ type Foo() = assertRange (3, 18) (3, 22) mWithKeyword | _ -> Assert.Fail "Could not get valid AST" -[] -let ``SynTypeDefn with AutoProperty contains the range of the with keyword`` () = - let parseResults = - getParseResults - """ -type Foo() = - member val AutoProperty = autoProp with get, set - member val AutoProperty2 = autoProp -""" - - match parseResults with - | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ - SynModuleDecl.Types( - typeDefns = [ SynTypeDefn(typeRepr = SynTypeDefnRepr.ObjectModel(members = [_ - SynMemberDefn.AutoProperty(withKeyword=Some mWith) - SynMemberDefn.AutoProperty(withKeyword=None)])) ] - ) - ]) ])) -> - assertRange (3, 39) (3, 43) mWith - | _ -> Assert.Fail "Could not get valid AST" - -[] -let ``SynTypeDefn with AbstractSlot contains the range of the with keyword`` () = - let parseResults = - getParseResults - """ -type Foo() = - abstract member Bar : int with get,set -""" - - match parseResults with - | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ - SynModuleDecl.Types( - typeDefns = [ SynTypeDefn(typeRepr = SynTypeDefnRepr.ObjectModel(members = [_ - SynMemberDefn.AbstractSlot(slotSig=SynValSig(trivia = { WithKeyword = Some mWith }))])) ] - ) - ]) ])) -> - assertRange (3, 30) (3, 34) mWith - | _ -> Assert.Fail "Could not get valid AST" - -[] -let ``read-only property in SynMemberDefn.Member contains the range of the with keyword`` () = - let parseResults = - getParseResults - """ -type Foo() = - // A read-only property. - member this.MyReadProperty with get () = myInternalValue -""" - - match parseResults with - | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ - SynModuleDecl.Types( - typeDefns = [ SynTypeDefn(typeRepr = - SynTypeDefnRepr.ObjectModel(members=[ - _ - SynMemberDefn.GetSetMember(Some(SynBinding _), None, _, { WithKeyword = mWith }) ]) - ) ]) - ]) ])) -> - assertRange (4, 31) (4, 35) mWith - | _ -> Assert.Fail "Could not get valid AST" - -[] -let ``write-only property in SynMemberDefn.Member contains the range of the with keyword`` () = - let parseResults = - getParseResults - """ -type Foo() = - // A write-only property. - member this.MyWriteOnlyProperty with set (value) = myInternalValue <- value -""" - - match parseResults with - | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ - SynModuleDecl.Types( - typeDefns = [ SynTypeDefn(typeRepr = - SynTypeDefnRepr.ObjectModel(members=[ - _ - SynMemberDefn.GetSetMember(None, Some(SynBinding _), _, { WithKeyword = mWith }) ]) - ) ]) - ]) ])) -> - assertRange (4, 36) (4, 40) mWith - | _ -> Assert.Fail "Could not get valid AST" - -[] -let ``read/write property in SynMemberDefn.Member contains the range of the with keyword`` () = - let parseResults = - getParseResults - """ -type Foo() = - // A read-write property. - member this.MyReadWriteProperty - with get () = myInternalValue - and set (value) = myInternalValue <- value -""" - - match parseResults with - | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ - SynModuleDecl.Types( - typeDefns = [ SynTypeDefn(typeRepr = - SynTypeDefnRepr.ObjectModel(members=[ - _ - SynMemberDefn.GetSetMember(Some _, Some _, _, { WithKeyword = mWith; AndKeyword = Some mAnd }) ]) - ) ]) - ]) ])) -> - assertRange (5, 8) (5, 12) mWith - assertRange (6, 8) (6, 11) mAnd - | _ -> Assert.Fail "Could not get valid AST" - [] let ``SynTypeDefn with XmlDoc contains the range of the type keyword`` () = let parseResults = @@ -399,70 +270,6 @@ type A = B assertRange (4, 0) (4, 4) mType | _ -> Assert.Fail "Could not get valid AST" -[] -let ``SynTypeDefn with static member with get/set`` () = - let parseResults = - getParseResults - """ -type Foo = - static member ReadWrite2 - with set x = lastUsed <- ("ReadWrite2", x) - and get () = lastUsed <- ("ReadWrite2", 0); 4 -""" - - match parseResults with - | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ - SynModuleDecl.Types( - typeDefns = [ SynTypeDefn(typeRepr = SynTypeDefnRepr.ObjectModel(members = [ - SynMemberDefn.GetSetMember(Some _, Some _, m, { WithKeyword = mWith - GetKeyword = Some mGet - AndKeyword = Some mAnd - SetKeyword = Some mSet }) - ])) ] - ) - ]) ])) -> - assertRange (4, 8) (4, 12) mWith - assertRange (4, 13) (4, 16) mSet - assertRange (5, 8) (5, 11) mAnd - assertRange (5, 13) (5, 16) mGet - assertRange (3, 4) (5, 54) m - | _ -> Assert.Fail "Could not get valid AST" - -[] -let ``SynTypeDefn with member with set/get`` () = - let parseResults = - getParseResults - """ -type A() = - member this.Z with set (_:int):unit = () and get():int = 1 -""" - - match parseResults with - | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ - SynModuleDecl.Types( - typeDefns = [ SynTypeDefn(typeRepr = SynTypeDefnRepr.ObjectModel(members = [ - SynMemberDefn.ImplicitCtor _ - SynMemberDefn.GetSetMember(Some (SynBinding(headPat = SynPat.LongIdent(extraId = Some getIdent))), - Some (SynBinding(headPat = SynPat.LongIdent(extraId = Some setIdent))), - m, - { WithKeyword = mWith - GetKeyword = Some mGet - AndKeyword = Some mAnd - SetKeyword = Some mSet }) - ])) ] - ) - ]) ])) -> - Assert.AreEqual("get", getIdent.idText) - Assert.AreEqual("set", setIdent.idText) - assertRange (3, 18) (3, 22) mWith - assertRange (3, 23) (3, 26) mSet - assertRange (3, 23) (3, 26) setIdent.idRange - assertRange (3, 45) (3, 48) mAnd - assertRange (3, 49) (3, 52) mGet - assertRange (3, 49) (3, 52) getIdent.idRange - assertRange (3, 4) (3, 62) m - | _ -> Assert.Fail "Could not get valid AST" - [] let ``SynType.Fun has range of arrow`` () = let parseResults = @@ -502,7 +309,7 @@ let _: struct (int * int) = () ]) ) -> assertRange (2, 7) (2, 25) mTuple - + | _ -> Assert.Fail $"Could not get valid AST, got {parseResults}" [] @@ -522,7 +329,7 @@ let _: struct (int * int = () ]) ) -> assertRange (2, 7) (2, 24) mTuple - + | _ -> Assert.Fail $"Could not get valid AST, got {parseResults}" [] @@ -593,4 +400,4 @@ type X = ])) -> Assert.AreEqual("a", a.idText) assertRange (3, 23) (3, 41) m - | _ -> Assert.Fail $"Could not get valid AST, got {parseResults}" \ No newline at end of file + | _ -> Assert.Fail $"Could not get valid AST, got {parseResults}" diff --git a/vsintegration/src/FSharp.Editor/CodeLens/CodeLensGeneralTagger.fs b/vsintegration/src/FSharp.Editor/CodeLens/CodeLensGeneralTagger.fs deleted file mode 100644 index fbc54c1e5fc..00000000000 --- a/vsintegration/src/FSharp.Editor/CodeLens/CodeLensGeneralTagger.fs +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace rec Microsoft.VisualStudio.FSharp.Editor - -open System -open System.Windows.Controls -open Microsoft.VisualStudio.Text -open Microsoft.VisualStudio.Text.Editor -open Microsoft.VisualStudio.Text.Formatting -open System.Windows -open Microsoft.VisualStudio.Text.Tagging - -open Microsoft.VisualStudio.FSharp.Editor.Logging - -type CodeLensGeneralTag(width, topSpace, baseline, textHeight, bottomSpace, affinity, tag:obj, providerTag:obj) = - inherit SpaceNegotiatingAdornmentTag(width, topSpace, baseline, textHeight, bottomSpace, affinity, tag, providerTag) - -/// Class which provides support for general code lens -/// Use the methods AddCodeLens and RemoveCodeLens -type CodeLensGeneralTagger (view, buffer) as self = - inherit CodeLensDisplayService(view, buffer, "CodeLens") - - /// The tags changed event to notify if the data for the tags has changed. - let tagsChangedEvent = new Event,SnapshotSpanEventArgs>() - - /// Layouts all stack panels on the line - override self.LayoutUIElementOnLine (view:IWpfTextView) (line:ITextViewLine) (ui:Grid) = - let left, top = - match self.UiElementNeighbour.TryGetValue ui with - | true, parent -> - let left = Canvas.GetLeft parent - let top = Canvas.GetTop parent - let width = parent.ActualWidth -#if DEBUG - logInfof "Width of parent: %.4f" width -#endif - left + width, top - | _ -> - try - // Get the real offset so that the code lens are placed respectively to their content - let offset = - [0..line.Length - 1] |> Seq.tryFind (fun i -> not (Char.IsWhiteSpace (line.Start.Add(i).GetChar()))) - |> Option.defaultValue 0 - - let realStart = line.Start.Add(offset) - let g = view.TextViewLines.GetCharacterBounds(realStart) - // WORKAROUND VS BUG, left cannot be zero if the offset is creater than zero! - // Calling the method twice fixes this bug and ensures that all values are correct. - // Okay not really :( Must be replaced later with an own calculation depending on editor font settings! - if 7 * offset > int g.Left then -#if DEBUG - logErrorf "Incorrect return from geometry measure" -#endif - Canvas.GetLeft ui, g.Top - else - g.Left, g.Top - with e -> -#if DEBUG - logExceptionWithContext (e, "Error in layout ui element on line") -#else - ignore e -#endif - Canvas.GetLeft ui, Canvas.GetTop ui - Canvas.SetLeft(ui, left) - Canvas.SetTop(ui, top) - - override self.AsyncCustomLayoutOperation _ _ = - asyncMaybe { - // Suspend 16 ms, instantly applying the layout to the adornment elements isn't needed - // and would consume too much performance - do! Async.Sleep(16) |> liftAsync // Skip at least one frames - do! Async.SwitchToContext self.UiContext |> liftAsync - let layer = self.CodeLensLayer - - do! Async.Sleep(495) |> liftAsync - - // WORKAROUND FOR VS BUG - // The layout changed event may not provide us all real changed lines so - // we take care of this on our own. - let visibleSpan = - let first, last = - view.TextViewLines.FirstVisibleLine, - view.TextViewLines.LastVisibleLine - SnapshotSpan(first.Start, last.End) - let customVisibleLines = view.TextViewLines.GetTextViewLinesIntersectingSpan visibleSpan - let isLineVisible (line:ITextViewLine) = line.IsValid - let linesToProcess = customVisibleLines |> Seq.filter isLineVisible - - for line in linesToProcess do - try - match line.GetAdornmentTags self |> Seq.tryHead with - | Some (:? seq as stackPanels) -> - for stackPanel in stackPanels do - if stackPanel |> self.AddedAdornments.Contains |> not then - layer.AddAdornment(AdornmentPositioningBehavior.OwnerControlled, Nullable(), - self, stackPanel, AdornmentRemovedCallback(fun _ _ -> ())) |> ignore - self.AddedAdornments.Add stackPanel |> ignore - | _ -> () - with e -> -#if DEBUG - logExceptionWithContext (e, "LayoutChanged, processing new visible lines") -#else - ignore e -#endif - } |> Async.Ignore - - override self.AddUiElementToCodeLens (trackingSpan:ITrackingSpan, uiElement:UIElement)= - base.AddUiElementToCodeLens (trackingSpan, uiElement) // We do the same as the base call execpt that we need to notify that the tag needs to be refreshed. - tagsChangedEvent.Trigger(self, SnapshotSpanEventArgs(trackingSpan.GetSpan(buffer.CurrentSnapshot))) - - override self.RemoveUiElementFromCodeLens (trackingSpan:ITrackingSpan, uiElement:UIElement) = - base.RemoveUiElementFromCodeLens (trackingSpan, uiElement) - tagsChangedEvent.Trigger(self, SnapshotSpanEventArgs(trackingSpan.GetSpan(buffer.CurrentSnapshot))) // Need to refresh the tag. - - interface ITagger with - [] - override _.TagsChanged = tagsChangedEvent.Publish - - /// Returns the tags which reserve the correct space for adornments - /// Notice, it's asumed that the data in the collection is valid. - override _.GetTags spans = - try - seq { - for span in spans do - let snapshot = span.Snapshot - let lineNumber = - try - snapshot.GetLineNumberFromPosition(span.Start.Position) - with e -> -#if DEBUG - logExceptionWithContext (e, "line number tagging") -#else - ignore e -#endif - 0 - if self.TrackingSpans.ContainsKey(lineNumber) && self.TrackingSpans.[lineNumber] |> Seq.isEmpty |> not then - - let tagSpan = snapshot.GetLineFromLineNumber(lineNumber).Extent - let stackPanels = - self.TrackingSpans.[lineNumber] - |> Seq.map (fun trackingSpan -> - let success, res = self.UiElements.TryGetValue trackingSpan - if success then res else null - ) - |> Seq.filter (isNull >> not) - let span = - try - tagSpan.TranslateTo(span.Snapshot, SpanTrackingMode.EdgeExclusive) - with e -> -#if DEBUG - logExceptionWithContext (e, "tag span translation") -#else - ignore e -#endif - tagSpan - let sizes = - try - stackPanels |> Seq.map (fun ui -> - ui.Measure(Size(10000., 10000.)) - ui.DesiredSize ) - with e -> -#if DEBUG - logExceptionWithContext (e, "internal tagging") -#else - ignore e -#endif - Seq.empty - let height = - try - sizes - |> Seq.map (fun size -> size.Height) - |> Seq.sortDescending - |> Seq.tryHead - |> Option.defaultValue 0. - with e -> -#if DEBUG - logExceptionWithContext (e, "height tagging") -#else - ignore e -#endif - 0.0 - - yield TagSpan(span, CodeLensGeneralTag(0., height, 0., 0., 0., PositionAffinity.Predecessor, stackPanels, self)) :> ITagSpan - } - with e -> -#if DEBUG - logErrorf "Error in code lens get tags %A" e -#else - ignore e -#endif - Seq.empty \ No newline at end of file diff --git a/vsintegration/src/FSharp.Editor/CodeLens/CodeLensProvider.fs b/vsintegration/src/FSharp.Editor/CodeLens/CodeLensProvider.fs index 8d3be2fcf35..abfa68e08b1 100644 --- a/vsintegration/src/FSharp.Editor/CodeLens/CodeLensProvider.fs +++ b/vsintegration/src/FSharp.Editor/CodeLens/CodeLensProvider.fs @@ -15,7 +15,6 @@ open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor.Shared.Utilities [)>] [)>] -[)>] [] [] type internal CodeLensProvider @@ -28,75 +27,37 @@ type internal CodeLensProvider settings: EditorOptions ) = - let lineLensProvider = ResizeArray() - let taggers = ResizeArray() + let tryGetTextDocument (buffer: ITextBuffer) (factory: ITextDocumentFactoryService) = + match factory.TryGetTextDocument buffer with + | true, document -> Some document + | _ -> None + + let lineLensProviders = ResizeArray() let componentModel = Package.GetGlobalService(typeof) :?> ComponentModelHost.IComponentModel let workspace = componentModel.GetService() - /// Returns an provider for the textView if already one has been created. Else create one. - let addCodeLensProviderOnce wpfView buffer = - let res = taggers |> Seq.tryFind(fun (view, _) -> view = wpfView) - match res with - | Some (_, (tagger, _)) -> tagger - | None -> - let documentId = - lazy ( - match textDocumentFactory.TryGetTextDocument(buffer) with - | true, textDocument -> - Seq.tryHead (workspace.CurrentSolution.GetDocumentIdsWithFilePath(textDocument.FilePath)) - | _ -> None - |> Option.get - ) - - let tagger = CodeLensGeneralTagger(wpfView, buffer) - let service = FSharpCodeLensService(serviceProvider, workspace, documentId, buffer, metadataAsSource, componentModel.GetService(), typeMap, tagger, settings) - let provider = (wpfView, (tagger, service)) - wpfView.Closed.Add (fun _ -> taggers.Remove provider |> ignore) - taggers.Add((wpfView, (tagger, service))) - tagger - - /// Returns an provider for the textView if already one has been created. Else create one. - let addLineLensProviderOnce wpfView buffer = - let res = lineLensProvider |> Seq.tryFind(fun (view, _) -> view = wpfView) - match res with - | None -> - let documentId = - lazy ( - match textDocumentFactory.TryGetTextDocument(buffer) with - | true, textDocument -> - Seq.tryHead (workspace.CurrentSolution.GetDocumentIdsWithFilePath(textDocument.FilePath)) - | _ -> None - |> Option.get - ) + let addLineLensProvider wpfView buffer = + textDocumentFactory + |> tryGetTextDocument buffer + |> Option.map (fun document -> workspace.CurrentSolution.GetDocumentIdsWithFilePath(document.FilePath)) + |> Option.bind Seq.tryHead + |> Option.map (fun documentId -> let service = FSharpCodeLensService(serviceProvider, workspace, documentId, buffer, metadataAsSource, componentModel.GetService(), typeMap, LineLensDisplayService(wpfView, buffer), settings) let provider = (wpfView, service) - wpfView.Closed.Add (fun _ -> lineLensProvider.Remove provider |> ignore) - lineLensProvider.Add(provider) - | _ -> () + wpfView.Closed.Add (fun _ -> lineLensProviders.Remove provider |> ignore) + lineLensProviders.Add(provider)) - [); Name("CodeLens"); - Order(Before = PredefinedAdornmentLayers.Text); - TextViewRole(PredefinedTextViewRoles.Document)>] - member val CodeLensAdornmentLayerDefinition : AdornmentLayerDefinition = null with get, set - [); Name("LineLens"); Order(Before = PredefinedAdornmentLayers.Text); TextViewRole(PredefinedTextViewRoles.Document)>] member val LineLensAdornmentLayerDefinition : AdornmentLayerDefinition = null with get, set - interface IViewTaggerProvider with - override _.CreateTagger(view, buffer) = - if settings.CodeLens.Enabled && not settings.CodeLens.ReplaceWithLineLens then - let wpfView = - match view with - | :? IWpfTextView as view -> view - | _ -> failwith "error" - - box(addCodeLensProviderOnce wpfView buffer) :?> _ - else - null - interface IWpfTextViewCreationListener with override _.TextViewCreated view = - if settings.CodeLens.Enabled && settings.CodeLens.ReplaceWithLineLens then - addLineLensProviderOnce view (view.TextBuffer) |> ignore \ No newline at end of file + if settings.CodeLens.Enabled then + let provider = + lineLensProviders + |> Seq.tryFind (fun (v, _) -> v = view) + + if provider.IsNone then + addLineLensProvider view (view.TextBuffer) |> ignore \ No newline at end of file diff --git a/vsintegration/src/FSharp.Editor/CodeLens/FSharpCodeLensService.fs b/vsintegration/src/FSharp.Editor/CodeLens/FSharpCodeLensService.fs index 2e18270e97e..18e0aa8098c 100644 --- a/vsintegration/src/FSharp.Editor/CodeLens/FSharpCodeLensService.fs +++ b/vsintegration/src/FSharp.Editor/CodeLens/FSharpCodeLensService.fs @@ -12,18 +12,12 @@ open System.Windows.Media open System.Windows.Media.Animation open Microsoft.CodeAnalysis -open Microsoft.CodeAnalysis.Editor.Shared.Extensions open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Classification open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor.Shared.Extensions -open FSharp.Compiler.CodeAnalysis -open FSharp.Compiler.Diagnostics -open FSharp.Compiler.EditorServices open FSharp.Compiler.Symbols open FSharp.Compiler.Syntax open FSharp.Compiler.Text -open FSharp.Compiler.Text -open FSharp.Compiler.Tokenization open Microsoft.VisualStudio.FSharp.Editor.Logging open Microsoft.VisualStudio.Shell.Interop @@ -32,17 +26,17 @@ open Microsoft.VisualStudio.Text.Classification open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor.Shared.Utilities -type internal CodeLens(taggedText, computed, fullTypeSignature, uiElement) = +type internal CodeLens(taggedText, computed, funcID, uiElement) = member val TaggedText: Async<(ResizeArray * FSharpNavigation) option> = taggedText member val Computed: bool = computed with get, set - member val FullTypeSignature: string = fullTypeSignature + member val FuncID: string = funcID member val UiElement: UIElement = uiElement with get, set type internal FSharpCodeLensService ( serviceProvider: IServiceProvider, workspace: Workspace, - documentId: Lazy, + documentId: DocumentId, buffer: ITextBuffer, metadataAsSource: FSharpMetadataAsSourceService, classificationFormatMapService: IClassificationFormatMapService, @@ -153,7 +147,7 @@ type internal FSharpCodeLensService #if DEBUG logInfof "Rechecking code due to buffer edit!" #endif - let! document = workspace.CurrentSolution.GetDocument(documentId.Value) |> Option.ofObj + let! document = workspace.CurrentSolution.GetDocument documentId |> Option.ofObj let! parseFileResults, checkFileResults = document.GetFSharpParseAndCheckResultsAsync(nameof(FSharpUseMutationWhenValueIsMutableFixProvider)) |> liftAsync let parsedInput = parseFileResults.ParseTree #if DEBUG @@ -221,14 +215,12 @@ type internal FSharpCodeLensService match symbolUse.Symbol with | :? FSharpMemberOrFunctionOrValue as func when func.IsModuleValueOrMember || func.IsProperty -> let funcID = func.LogicalName + (func.FullType.ToString() |> hash |> string) - // Use a combination of the the function name + the hashed value of the type signature - let fullTypeSignature = func.FullType.ToString() // Try to re-use the last results if lastResults.ContainsKey funcID then // Make sure that the results are usable let inline setNewResultsAndWarnIfOverridenLocal value = setNewResultsAndWarnIfOverriden funcID value let lastTrackingSpan, codeLens as lastResult = lastResults.[funcID] - if codeLens.FullTypeSignature = fullTypeSignature then + if codeLens.FuncID = funcID then setNewResultsAndWarnIfOverridenLocal lastResult oldResults.Remove funcID |> ignore else @@ -247,7 +239,7 @@ type internal FSharpCodeLensService let res = CodeLens( Async.cache (useResults (symbolUse.DisplayContext, func, range)), false, - fullTypeSignature, + funcID, null) // The old results aren't computed at all, because the line might have changed create new results tagsToUpdate.[lastTrackingSpan] <- (newTrackingSpan, funcID, res) @@ -257,12 +249,12 @@ type internal FSharpCodeLensService else // The symbol might be completely new or has slightly changed. // We need to track this and iterate over the left entries to ensure that there isn't anything - unattachedSymbols.Add((symbolUse, func, funcID, fullTypeSignature)) + unattachedSymbols.Add(symbolUse, func, funcID) | _ -> () // In best case this works quite `covfefe` fine because often enough we change only a small part of the file and not the complete. for unattachedSymbol in unattachedSymbols do - let symbolUse, func, funcID, fullTypeSignature = unattachedSymbol + let symbolUse, func, funcID = unattachedSymbol let declarationLine, range = match visit func.DeclarationLocation.Start parsedInput with | Some range -> range.StartLine - 1, range @@ -270,7 +262,7 @@ type internal FSharpCodeLensService let test (v:KeyValuePair<_, _>) = let _, (codeLens:CodeLens) = v.Value - codeLens.FullTypeSignature = fullTypeSignature + codeLens.FuncID = funcID match oldResults |> Seq.tryFind test with | Some res -> let (trackingSpan : ITrackingSpan), (codeLens : CodeLens) = res.Value @@ -288,7 +280,7 @@ type internal FSharpCodeLensService CodeLens( Async.cache (useResults (symbolUse.DisplayContext, func, range)), false, - fullTypeSignature, + funcID, null) // The tag might be still valid but it hasn't been computed yet so create fresh results tagsToUpdate.[trackingSpan] <- (newTrackingSpan, funcID, res) @@ -303,7 +295,7 @@ type internal FSharpCodeLensService CodeLens( Async.cache (useResults (symbolUse.DisplayContext, func, range)), false, - fullTypeSignature, + funcID, null) try let declarationSpan = @@ -347,7 +339,7 @@ type internal FSharpCodeLensService sb.Begin() else #if DEBUG - logWarningf "Couldn't retrieve code lens information for %A" codeLens.FullTypeSignature + logWarningf "Couldn't retrieve code lens information for %A" codeLens.FuncID #endif () } |> (RoslynHelpers.StartAsyncSafe CancellationToken.None) "UIElement creation" diff --git a/vsintegration/src/FSharp.Editor/CodeLens/LineLensDisplayService.fs b/vsintegration/src/FSharp.Editor/CodeLens/LineLensDisplayService.fs index a34df51c722..85f0349112a 100644 --- a/vsintegration/src/FSharp.Editor/CodeLens/LineLensDisplayService.fs +++ b/vsintegration/src/FSharp.Editor/CodeLens/LineLensDisplayService.fs @@ -16,23 +16,16 @@ type internal LineLensDisplayService (view, buffer) = /// Layouts all stack panels on the line override self.LayoutUIElementOnLine _ (line:ITextViewLine) (ui:Grid) = let left, top = - match self.UiElementNeighbour.TryGetValue ui with - | true, parent -> - let left = Canvas.GetLeft parent - let top = Canvas.GetTop parent - let width = parent.ActualWidth - left + width, top - | _ -> - try - let bounds = line.GetCharacterBounds(line.Start) - line.TextRight + 5.0, bounds.Top - 1. - with e -> + try + let bounds = line.GetCharacterBounds(line.Start) + line.TextRight + 5.0, bounds.Top - 1. + with e -> #if DEBUG - logExceptionWithContext (e, "Error in layout ui element on line") + logExceptionWithContext (e, "Error in layout ui element on line") #else - ignore e + ignore e #endif - Canvas.GetLeft ui, Canvas.GetTop ui + Canvas.GetLeft ui, Canvas.GetTop ui Canvas.SetLeft(ui, left) Canvas.SetTop(ui, top) diff --git a/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj b/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj index 156c187769d..c3fbf9a4258 100644 --- a/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj +++ b/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj @@ -126,7 +126,6 @@ - diff --git a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs index 203867a6afe..ed20c78bf39 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs @@ -93,20 +93,39 @@ type internal FSharpWorkspaceServiceFactory match checkerSingleton with | Some _ -> () | _ -> - let checker = + let checker = lazy - let checker = + let editorOptions = + let editorOptions = workspace.Services.GetService() + + match box editorOptions with + | null -> None + | _ -> Some editorOptions + + let enableParallelCheckingWithSignatureFiles = + editorOptions + |> Option.map (fun options -> options.LanguageServicePerformance.EnableParallelCheckingWithSignatureFiles) + |> Option.defaultValue false + + let enableParallelReferenceResolution = + editorOptions + |> Option.map (fun options -> options.LanguageServicePerformance.EnableParallelReferenceResolution) + |> Option.defaultValue false + + let checker = FSharpChecker.Create( - projectCacheSize = 5000, // We do not care how big the cache is. VS will actually tell FCS to clear caches, so this is fine. + projectCacheSize = 5000, // We do not care how big the cache is. VS will actually tell FCS to clear caches, so this is fine. keepAllBackgroundResolutions = false, legacyReferenceResolver=LegacyMSBuildReferenceResolver.getResolver(), tryGetMetadataSnapshot = tryGetMetadataSnapshot, keepAllBackgroundSymbolUses = false, enableBackgroundItemKeyStoreAndSemanticClassification = true, - enablePartialTypeChecking = true) - checker - checkerSingleton <- Some checker - ) + enablePartialTypeChecking = true, + enableParallelCheckingWithSignatureFiles = enableParallelCheckingWithSignatureFiles, + parallelReferenceResolution = enableParallelReferenceResolution) + checker + checkerSingleton <- Some checker + ) let optionsManager = lazy diff --git a/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs b/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs index 689c410b5f1..b2df69f41eb 100644 --- a/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs +++ b/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs @@ -63,23 +63,23 @@ type LanguageServicePerformanceOptions = { EnableInMemoryCrossProjectReferences: bool AllowStaleCompletionResults: bool TimeUntilStaleCompletion: int - ProjectCheckCacheSize: int } + EnableParallelCheckingWithSignatureFiles: bool + EnableParallelReferenceResolution: bool } static member Default = { EnableInMemoryCrossProjectReferences = true AllowStaleCompletionResults = true TimeUntilStaleCompletion = 2000 // In ms, so this is 2 seconds - ProjectCheckCacheSize = 200 } + EnableParallelCheckingWithSignatureFiles = false + EnableParallelReferenceResolution = false } [] type CodeLensOptions = { Enabled : bool - ReplaceWithLineLens: bool UseColors: bool Prefix : string } static member Default = { Enabled = false UseColors = false - ReplaceWithLineLens = true Prefix = "// " } [] diff --git a/vsintegration/src/FSharp.UIResources/CodeLensOptionControl.xaml b/vsintegration/src/FSharp.UIResources/CodeLensOptionControl.xaml index 7e62f575fd6..750cc260b43 100644 --- a/vsintegration/src/FSharp.UIResources/CodeLensOptionControl.xaml +++ b/vsintegration/src/FSharp.UIResources/CodeLensOptionControl.xaml @@ -27,9 +27,6 @@ - diff --git a/vsintegration/src/FSharp.UIResources/FSharp.UIResources.csproj b/vsintegration/src/FSharp.UIResources/FSharp.UIResources.csproj index b11c35d2187..1dfea7e42c8 100644 --- a/vsintegration/src/FSharp.UIResources/FSharp.UIResources.csproj +++ b/vsintegration/src/FSharp.UIResources/FSharp.UIResources.csproj @@ -24,4 +24,19 @@ + + + True + True + Strings.resx + + + + + + PublicResXFileCodeGenerator + Strings.Designer.cs + + + diff --git a/vsintegration/src/FSharp.UIResources/LanguageServicePerformanceOptionControl.xaml b/vsintegration/src/FSharp.UIResources/LanguageServicePerformanceOptionControl.xaml index e67690250dd..26a38d423d5 100644 --- a/vsintegration/src/FSharp.UIResources/LanguageServicePerformanceOptionControl.xaml +++ b/vsintegration/src/FSharp.UIResources/LanguageServicePerformanceOptionControl.xaml @@ -23,27 +23,6 @@ IsChecked="{Binding EnableInMemoryCrossProjectReferences}" Content="{x:Static local:Strings.Enable_in_memory_cross_project_references}" ToolTip="{x:Static local:Strings.Tooltip_in_memory_cross_project_references}"/> - - - - - - @@ -75,6 +54,16 @@ + + + + + + diff --git a/vsintegration/src/FSharp.UIResources/Strings.Designer.cs b/vsintegration/src/FSharp.UIResources/Strings.Designer.cs index fd74fbb404f..2227b3e1819 100644 --- a/vsintegration/src/FSharp.UIResources/Strings.Designer.cs +++ b/vsintegration/src/FSharp.UIResources/Strings.Designer.cs @@ -19,7 +19,7 @@ namespace Microsoft.VisualStudio.FSharp.UIResources { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class Strings { @@ -177,6 +177,24 @@ public static string Enable_in_memory_cross_project_references { } } + /// + /// Looks up a localized string similar to Enable parallel type checking with signature files. + /// + public static string Enable_Parallel_Checking_With_Signature_Files { + get { + return ResourceManager.GetString("Enable_Parallel_Checking_With_Signature_Files", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Enable parallel reference resolution. + /// + public static string Enable_Parallel_Reference_Resolution { + get { + return ResourceManager.GetString("Enable_Parallel_Reference_Resolution", resourceCulture); + } + } + /// /// Looks up a localized string similar to Enable stale data for IntelliSense features. /// @@ -223,7 +241,7 @@ public static string Enter_Key_Rule { } /// - /// Looks up a localized string similar to Re-format indentation on paste. + /// Looks up a localized string similar to Re-format indentation on paste (Experimental). /// public static string Format_on_paste { get { @@ -268,11 +286,11 @@ public static string Outlining { } /// - /// Looks up a localized string similar to Number of projects whose data is cached in memory. + /// Looks up a localized string similar to Parallelization (requires restart). /// - public static string Project_check_cache_size { + public static string Parallelization { get { - return ResourceManager.GetString("Project_check_cache_size", resourceCulture); + return ResourceManager.GetString("Parallelization", resourceCulture); } } @@ -393,15 +411,6 @@ public static string Tooltip_in_memory_cross_project_references { } } - /// - /// Looks up a localized string similar to Project data is cached for IDE features. Higher values use more memory because more projects are cached. Tuning this value should not affect small or medium-sized solutions.. - /// - public static string Tooltip_project_check_cache_size { - get { - return ResourceManager.GetString("Tooltip_project_check_cache_size", resourceCulture); - } - } - /// /// Looks up a localized string similar to Analyze and suggest fixes for unused values. /// diff --git a/vsintegration/src/FSharp.UIResources/Strings.resx b/vsintegration/src/FSharp.UIResources/Strings.resx index b0ceb57d47a..9846b778ddc 100644 --- a/vsintegration/src/FSharp.UIResources/Strings.resx +++ b/vsintegration/src/FSharp.UIResources/Strings.resx @@ -165,9 +165,6 @@ _Enable in-memory cross project references - - Number of projects whose data is cached in memory - S_how navigation links as @@ -210,9 +207,6 @@ In-memory cross-project references store project-level data in memory to allow IDE features to work across projects. - - Project data is cached for IDE features. Higher values use more memory because more projects are cached. Tuning this value should not affect small or medium-sized solutions. - Always add new line on enter @@ -237,4 +231,13 @@ Diagnostics + + Parallelization (requires restart) + + + Enable parallel type checking with signature files + + + Enable parallel reference resolution + \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf index eb4650c57ed..a2cc11c84f8 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf @@ -47,6 +47,16 @@ Diagnostika + + Enable parallel type checking with signature files + Enable parallel type checking with signature files + + + + Enable parallel reference resolution + Enable parallel reference resolution + + Performance Výkon @@ -67,6 +77,11 @@ Navigační odkazy + + Parallelization (requires restart) + Parallelization (requires restart) + + Show s_ymbols in unopened namespaces Zobrazit s_ymboly v neotevřených oborech názvů @@ -87,11 +102,6 @@ _Povolit odkazy mezi projekty v paměti - - Number of projects whose data is cached in memory - Počet projektů, jejichž data jsou uložená v mezipaměti - - S_how navigation links as Zo_brazit navigační odkazy jako @@ -167,11 +177,6 @@ V odkazech v paměti pro různé projekty jsou uložená data na úrovni projektů, aby mohly mezi projekty fungovat funkce IDE. - - Project data is cached for IDE features. Higher values use more memory because more projects are cached. Tuning this value should not affect small or medium-sized solutions. - Projektová data jsou uložená v mezipaměti pro funkce IDE. Vyšší hodnoty znamenají využití více paměti, protože je uloženo více projektů. Vyladění této hodnoty by nemělo mít vliv na malá a středně velká řešení. - - Always add new line on enter Při stisku Enter vždy přidat nový řádek diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf index 7db4ba605f3..3724e517a15 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf @@ -47,6 +47,16 @@ Diagnose + + Enable parallel type checking with signature files + Enable parallel type checking with signature files + + + + Enable parallel reference resolution + Enable parallel reference resolution + + Performance Leistung @@ -67,6 +77,11 @@ Navigationslinks + + Parallelization (requires restart) + Parallelization (requires restart) + + Show s_ymbols in unopened namespaces S_ymbole in nicht geöffneten Namespaces anzeigen @@ -87,11 +102,6 @@ Proj_ektübergreifende Verweise im Arbeitsspeicher aktivieren - - Number of projects whose data is cached in memory - Anzahl von Projekten, deren Daten im Arbeitsspeicher zwischengespeichert werden - - S_how navigation links as Navigationslink_s anzeigen als @@ -167,11 +177,6 @@ Bei projektübergreifenden In-Memory-Verweisen werden Daten auf Projektebene im Arbeitsspeicher abgelegt, damit IDE-Features projektübergreifend verwendet werden können. - - Project data is cached for IDE features. Higher values use more memory because more projects are cached. Tuning this value should not affect small or medium-sized solutions. - Für IDE-Features werden Projektdaten zwischengespeichert. Bei höheren Werten wird mehr Arbeitsspeicher beansprucht, weil mehr Projekte zwischengespeichert werden. Die Optimierung dieses Werts besitzt keine Auswirkungen auf kleine oder mittelgroße Projektmappen. - - Always add new line on enter Nach Drücken der EINGABETASTE immer neue Zeile hinzufügen diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf index 674c69434c2..b8fe4df4030 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf @@ -47,6 +47,16 @@ Diagnóstico + + Enable parallel type checking with signature files + Enable parallel type checking with signature files + + + + Enable parallel reference resolution + Enable parallel reference resolution + + Performance Rendimiento @@ -67,6 +77,11 @@ Vínculos de navegación + + Parallelization (requires restart) + Parallelization (requires restart) + + Show s_ymbols in unopened namespaces Mostrar sím_bolos en espacios de nombres sin abrir @@ -87,11 +102,6 @@ _Habilitar referencias entre proyectos en memoria - - Number of projects whose data is cached in memory - Número de proyectos cuyos datos se almacenan en la memoria caché - - S_how navigation links as M_ostrar vínculos de navegación como @@ -167,11 +177,6 @@ Las referencias en memoria entre proyectos almacenan los datos de nivel de proyecto en memoria para permitir que las características del IDE funcionen de unos proyectos a otros. - - Project data is cached for IDE features. Higher values use more memory because more projects are cached. Tuning this value should not affect small or medium-sized solutions. - Los datos de proyecto se almacenan en caché para que funcionen las características del IDE. Los valores más altos utilizan más memoria porque se almacenan en caché más proyectos. El ajuste de este valor no debería afectar a soluciones de tamaño pequeño o medio. - - Always add new line on enter Siempre agregar una nueva línea al pulsar Intro diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf index ec9bafbe8df..82a00f7f4ac 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf @@ -47,6 +47,16 @@ Diagnostics + + Enable parallel type checking with signature files + Enable parallel type checking with signature files + + + + Enable parallel reference resolution + Enable parallel reference resolution + + Performance Performances @@ -67,6 +77,11 @@ Liens de navigation + + Parallelization (requires restart) + Parallelization (requires restart) + + Show s_ymbols in unopened namespaces Afficher les sym_boles dans les espaces de noms non ouverts @@ -87,11 +102,6 @@ _Activer les références de projet croisé en mémoire - - Number of projects whose data is cached in memory - Nombre de projets dont les données sont mises en cache dans la mémoire - - S_how navigation links as Affic_her les liens de navigation en tant que @@ -167,11 +177,6 @@ Les références inter-projets en mémoire stockent les données de niveau projet dans la mémoire pour permettre aux fonctionnalités de l'IDE de fonctionner sur plusieurs projets. - - Project data is cached for IDE features. Higher values use more memory because more projects are cached. Tuning this value should not affect small or medium-sized solutions. - Les données de projet sont mises en cache pour les fonctionnalités de l'IDE. Les valeurs plus élevées utilisent plus de mémoire, car davantage de projets sont mis en cache. L'ajustement de cette valeur ne devrait pas affecter les petites ou moyennes solutions. - - Always add new line on enter Toujours ajouter une nouvelle ligne en appuyant sur Entrée diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf index 9b2acf06d1b..3f5a0bef8bb 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf @@ -47,6 +47,16 @@ Diagnostica + + Enable parallel type checking with signature files + Enable parallel type checking with signature files + + + + Enable parallel reference resolution + Enable parallel reference resolution + + Performance Prestazioni @@ -67,6 +77,11 @@ Collegamenti di navigazione + + Parallelization (requires restart) + Parallelization (requires restart) + + Show s_ymbols in unopened namespaces Mostra si_mboli in spazi dei nomi non aperti @@ -87,11 +102,6 @@ _Abilita i riferimenti tra progetti in memoria - - Number of projects whose data is cached in memory - Numero di progetti i cui dati sono disponibili nella cache in memoria - - S_how navigation links as M_ostra collegamenti di navigazione come @@ -167,11 +177,6 @@ I riferimenti tra progetti in memoria consentono di archiviare in memoria i dati a livello di progetto per consentire l'uso di funzionalità IDE tra progetti. - - Project data is cached for IDE features. Higher values use more memory because more projects are cached. Tuning this value should not affect small or medium-sized solutions. - I dati del progetto sono memorizzati nella cache per le funzionalità IDE. Con valori più elevati viene usata una maggiore quantità di memoria perché nella cache viene memorizzato un numero maggiore di progetti. La disattivazione di questo valore non dovrebbe influire su soluzioni di piccole e medie dimensioni. - - Always add new line on enter Aggiungi sempre una nuova riga dopo INVIO diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf index 8ab4c15b6e1..0476d98187d 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf @@ -47,6 +47,16 @@ 診断 + + Enable parallel type checking with signature files + Enable parallel type checking with signature files + + + + Enable parallel reference resolution + Enable parallel reference resolution + + Performance パフォーマンス @@ -67,6 +77,11 @@ ナビゲーション リンク + + Parallelization (requires restart) + Parallelization (requires restart) + + Show s_ymbols in unopened namespaces 開かれていない名前空間の記号を表示する(_Y) @@ -87,11 +102,6 @@ メモリ内のプロジェクト間参照を有効にする(_E) - - Number of projects whose data is cached in memory - データがメモリ内にキャッシュされているプロジェクトの数 - - S_how navigation links as 次としてナビゲーション リンクを表示する(_H) @@ -167,11 +177,6 @@ メモリ内のプロジェクト間参照に、プロジェクトをまたいで IDE 機能を動作可能にするプロジェクト レベルのデータが格納されます。 - - Project data is cached for IDE features. Higher values use more memory because more projects are cached. Tuning this value should not affect small or medium-sized solutions. - IDE 機能のためにプロジェクト データがキャッシュされます。値を高くすると、キャッシュされるプロジェクトが多くなるため、メモリ使用量が増えます。この値の調整は、小規模または中規模のソリューションに影響しません。 - - Always add new line on enter Enter を押すと常に新しい行を追加します diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf index 4812b0acc99..b14183356b6 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf @@ -47,6 +47,16 @@ 진단 + + Enable parallel type checking with signature files + Enable parallel type checking with signature files + + + + Enable parallel reference resolution + Enable parallel reference resolution + + Performance 성능 @@ -67,6 +77,11 @@ 탐색 링크 + + Parallelization (requires restart) + Parallelization (requires restart) + + Show s_ymbols in unopened namespaces 열려 있지 않은 네임스페이스에 기호 표시(_Y) @@ -87,11 +102,6 @@ 메모리 내 크로스 프로젝트 참조 사용(_E) - - Number of projects whose data is cached in memory - 메모리에 데이터가 캐시된 프로젝트 수 - - S_how navigation links as 탐색 링크를 다음으로 표시(_H) @@ -167,11 +177,6 @@ 메모리 내 크로스 프로젝트 참조가 메모리에 프로젝트 수준 데이터를 저장하여 IDE 기능이 프로젝트에서 작동하도록 합니다. - - Project data is cached for IDE features. Higher values use more memory because more projects are cached. Tuning this value should not affect small or medium-sized solutions. - 프로젝트 데이터가 IDE 기능에 대해 캐시됩니다. 값이 클수록 프로제트가 더 많이 캐시되므로 메모리를 더 많이 사용합니다. 이 값을 조정해도 중소 규모 솔루션에 영향을 미치지 않습니다. - - Always add new line on enter 입력 시 새 줄 항상 추가 diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf index c96168985ec..02fd84cb017 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf @@ -47,6 +47,16 @@ Diagnostyka + + Enable parallel type checking with signature files + Enable parallel type checking with signature files + + + + Enable parallel reference resolution + Enable parallel reference resolution + + Performance Wydajność @@ -67,6 +77,11 @@ Linki nawigacyjne + + Parallelization (requires restart) + Parallelization (requires restart) + + Show s_ymbols in unopened namespaces Pokaż s_ymbole w nieotwartych przestrzeniach nazw @@ -87,11 +102,6 @@ _Włącz odwołania między projektami w pamięci - - Number of projects whose data is cached in memory - Liczba projektów, które mają dane buforowane w pamięci - - S_how navigation links as P_okaż linki nawigacyjne jako @@ -167,11 +177,6 @@ Odwołania między projektami w pamięci przechowują dane na poziomie projektu w pamięci, aby umożliwić funkcjom środowiska IDE działanie w wielu projektach. - - Project data is cached for IDE features. Higher values use more memory because more projects are cached. Tuning this value should not affect small or medium-sized solutions. - Dane projektów są buforowane na potrzeby funkcji środowiska IDE. Wyższe wartości powodują używanie większej ilości pamięci, ponieważ buforowanych jest więcej projektów. Dostrajanie tej wartości nie powinno mieć wpływu na małe ani średnie rozwiązania. - - Always add new line on enter Zawsze dodawaj nowy wiersz po naciśnięciu klawisza Enter diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.pt-BR.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.pt-BR.xlf index 076de7f9087..7ca5a251c15 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.pt-BR.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.pt-BR.xlf @@ -47,6 +47,16 @@ Diagnóstico + + Enable parallel type checking with signature files + Enable parallel type checking with signature files + + + + Enable parallel reference resolution + Enable parallel reference resolution + + Performance Desempenho @@ -67,6 +77,11 @@ Links de navegação + + Parallelization (requires restart) + Parallelization (requires restart) + + Show s_ymbols in unopened namespaces Mostrar s_ímbolos em namespaces não abertos @@ -87,11 +102,6 @@ _Habilitar referências de projeto cruzado na memória - - Number of projects whose data is cached in memory - Número de projetos cujos dados estão em cache na memória - - S_how navigation links as E_xibir link de navegação como @@ -167,11 +177,6 @@ As referências entre projetos na memória armazenam os dados de nível de projeto na memória para permitir que os recursos do IDE funcionem nos projetos. - - Project data is cached for IDE features. Higher values use more memory because more projects are cached. Tuning this value should not affect small or medium-sized solutions. - Os dados do projeto são colocados em cache para os recursos do IDE. Os valores mais altos utilizam mais memória porque mais projetos são colocados em cache. O ajuste desses valores não deve afetar as soluções de pequeno ou médio porte. - - Always add new line on enter Sempre adicionar uma nova linha ao pressionar enter diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf index 690059925df..91c8065c0ca 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf @@ -47,6 +47,16 @@ Диагностика + + Enable parallel type checking with signature files + Enable parallel type checking with signature files + + + + Enable parallel reference resolution + Enable parallel reference resolution + + Performance Производительность @@ -67,6 +77,11 @@ Ссылки навигации + + Parallelization (requires restart) + Parallelization (requires restart) + + Show s_ymbols in unopened namespaces По_казать символы в неоткрытых пространствах имен @@ -87,11 +102,6 @@ _Включить перекрестные ссылки между проектами в памяти - - Number of projects whose data is cached in memory - Число проектов, данные которых кэшируются в памяти - - S_how navigation links as П_оказать ссылки навигации как @@ -167,11 +177,6 @@ Перекрестные ссылки между проектами в памяти хранят данные уровня проекта в памяти, поэтому функции и компоненты IDE могут работать в разных проектах. - - Project data is cached for IDE features. Higher values use more memory because more projects are cached. Tuning this value should not affect small or medium-sized solutions. - Для функций и компонентов IDE используются кэшированные данные проекта. Более высокие значения потребляют больший объем памяти, так как кэшируется больше проектов. Настройка этого значения не должна влиять на решения небольших или средних размеров. - - Always add new line on enter Всегда добавлять новую строку при нажатии клавиши ВВОД diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf index e05c403767a..f7de45984dc 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf @@ -47,6 +47,16 @@ Tanılama + + Enable parallel type checking with signature files + Enable parallel type checking with signature files + + + + Enable parallel reference resolution + Enable parallel reference resolution + + Performance Performans @@ -67,6 +77,11 @@ Gezinti bağlantıları + + Parallelization (requires restart) + Parallelization (requires restart) + + Show s_ymbols in unopened namespaces Açılmamış ad alanlarında s_embolleri göster @@ -87,11 +102,6 @@ _Bellek içi çapraz proje başvurularını etkinleştir - - Number of projects whose data is cached in memory - Verileri bellekte önbelleğe alınan proje sayısı - - S_how navigation links as Gezinti bağlantılarını farklı _göster @@ -167,11 +177,6 @@ Bellek içi projeler arası başvurular, IDE özelliklerinin farklı projelerde çalışmasına imkan tanımak için bellekte proje düzeyi veriler depolar. - - Project data is cached for IDE features. Higher values use more memory because more projects are cached. Tuning this value should not affect small or medium-sized solutions. - IDE özellikleri için proje verileri önbelleğe alınır. Değer yüksek olduğunda daha fazla proje önbelleğe alındığından daha fazla bellek kullanılır. Bu değerin ayarlanması küçük veya orta ölçekli çözümleri etkilememelidir. - - Always add new line on enter Enter'a basıldığında her zaman yeni satır ekle diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf index b219edc12c0..7478bb60d18 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf @@ -47,6 +47,16 @@ 诊断 + + Enable parallel type checking with signature files + Enable parallel type checking with signature files + + + + Enable parallel reference resolution + Enable parallel reference resolution + + Performance 性能 @@ -67,6 +77,11 @@ 导航链接 + + Parallelization (requires restart) + Parallelization (requires restart) + + Show s_ymbols in unopened namespaces 显示未打开的命名空间中的符号(_Y) @@ -87,11 +102,6 @@ 启用内存中跨项目引用(_E) - - Number of projects whose data is cached in memory - 内存中缓存了其数据的项目数 - - S_how navigation links as 导航链接显示方式(_H) @@ -167,11 +177,6 @@ 内存中跨项目引用将项目级数据存储在内存中,让 IDE 功能能够跨项目工作。 - - Project data is cached for IDE features. Higher values use more memory because more projects are cached. Tuning this value should not affect small or medium-sized solutions. - 针对 IDE 功能缓存项目数据。值越大,缓存的项目越多,因此使用的内存越多。调整此值不应影响小型或中型解决方案。 - - Always add new line on enter 始终在点击回车时时添加新行 diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf index 0b6b964edda..255c7ee09d5 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf @@ -47,6 +47,16 @@ 診斷 + + Enable parallel type checking with signature files + Enable parallel type checking with signature files + + + + Enable parallel reference resolution + Enable parallel reference resolution + + Performance 效能 @@ -67,6 +77,11 @@ 導覽連結 + + Parallelization (requires restart) + Parallelization (requires restart) + + Show s_ymbols in unopened namespaces 顯示未開啟之命名空間中的符號(_Y) @@ -87,11 +102,6 @@ 允許記憶體內跨專案參考(_E) - - Number of projects whose data is cached in memory - 資料會快取到記憶體的專案數 - - S_how navigation links as 顯示導覽連結為(_H) @@ -167,11 +177,6 @@ 記憶體內跨專案參考,會在記憶體中儲存專案等級的資料,以允許 IDE 功能在各專案中皆可運作。 - - Project data is cached for IDE features. Higher values use more memory because more projects are cached. Tuning this value should not affect small or medium-sized solutions. - 專案資料會進行快取,供 IDE 功能使用。值較高時會使用較多的記憶體,這是因為會快取較多的專案數。調整此值應該不會影響中小型的解決方案。 - - Always add new line on enter 一律在按 ENTER 時新增新行 From 8d87ef0a48c00e9bbb05e905dac0389f9ea9542b Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Mon, 10 Oct 2022 12:23:13 -0700 Subject: [PATCH 31/51] Update FSharp.Editor.fsproj I believe a bad merge happened, this line is not in main. And the file does not exist in either branch. --- vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj | 1 - 1 file changed, 1 deletion(-) diff --git a/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj b/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj index c3fbf9a4258..7021d1ae152 100644 --- a/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj +++ b/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj @@ -126,7 +126,6 @@ - From 5bdd01cf158a4b214f11025fdd45ac7e4774509f Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Mon, 10 Oct 2022 13:51:35 -0700 Subject: [PATCH 32/51] Localized file check-in by OneLocBuild Task: Build definition ID 499: Build ID 2014480 (#14049) --- src/Compiler/xlf/FSComp.txt.cs.xlf | 2 +- src/Compiler/xlf/FSComp.txt.de.xlf | 2 +- src/Compiler/xlf/FSComp.txt.es.xlf | 2 +- src/Compiler/xlf/FSComp.txt.fr.xlf | 2 +- src/Compiler/xlf/FSComp.txt.it.xlf | 2 +- src/Compiler/xlf/FSComp.txt.ja.xlf | 2 +- src/Compiler/xlf/FSComp.txt.ko.xlf | 2 +- src/Compiler/xlf/FSComp.txt.pl.xlf | 2 +- src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 2 +- src/Compiler/xlf/FSComp.txt.ru.xlf | 2 +- src/Compiler/xlf/FSComp.txt.tr.xlf | 2 +- src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 2 +- src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index 9dbc32b4b15..822297d4ff9 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Používá se ve vzájemně rekurzivních vazbách, v deklaracích vlastností a s několika omezeními u generických parametrů. diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index fcfdbb8afb0..afb89b3f305 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Wird in gegenseitig rekursiven Bindungen, in Eigenschaftendeklarationen und bei mehreren Beschränkungen in Bezug auf generische Parameter verwendet. diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index b11d915ab39..7bff656b19d 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Se usa en enlaces mutuamente recursivos, en declaraciones de propiedad y con varias restricciones en parámetros genéricos. diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index cb36f32b1f0..9e4bb29ee0c 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Utilisé dans les liaisons mutuellement récursives, dans les déclarations de propriété et avec plusieurs contraintes sur des paramètres génériques. diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 766e0e30348..6e56bbe7ee8 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Usata in binding ricorsivi reciproci, dichiarazioni di proprietà e con più vincoli su parametri generici. diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index 433aa7af0f5..18b818fea07 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + 相互に再帰的なバインディング、プロパティの宣言、およびジェネリック パラメーターの複数の制約に使用します。 diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 2e326e9ecf1..052d424f56f 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + 상호 재귀적 바인딩과 속성 선언에 사용되며 제네릭 매개 변수의 여러 제약 조건과 함께 사용됩니다. diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index 7fc1f4bbf36..eb4a2819499 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Używane w powiązaniach wzajemnie cyklicznych, deklaracjach właściwości oraz z wieloma ograniczeniami parametrów ogólnych. diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 292cef9ae5d..04e91c3089b 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Usado em associações mutualmente recursivas, em declarações de propriedade e em múltiplas restrições em parâmetros genéricos. diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index 995169db4e7..29bdaf2512e 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Используется во взаимно рекурсивных привязках, объявлениях свойств и с несколькими ограничениями для универсальных параметров. diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index 865ff430c4a..4b1b2804206 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Karşılıklı yinelemeli bağlamalarda, özellik bildirimlerinde ve genel parametreler üzerinde birden çok kısıtlamayla kullanılır. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index 66ca6254000..653c27378ca 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + 用于互相递归绑定、属性声明,并用于对泛型参数的多个约束。 diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index aee1dd1ed12..781002375e3 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + 用於互相遞迴的繫結、屬性宣告,以及搭配泛型參數的多個條件約束。 From bdd8468c203c596a3b75a32874d20560ff425dd5 Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Mon, 10 Oct 2022 22:12:10 -0700 Subject: [PATCH 33/51] Localized file check-in by OneLocBuild Task: Build definition ID 499: Build ID 2016907 --- src/Compiler/xlf/FSComp.txt.cs.xlf | 2 +- src/Compiler/xlf/FSComp.txt.de.xlf | 2 +- src/Compiler/xlf/FSComp.txt.es.xlf | 2 +- src/Compiler/xlf/FSComp.txt.fr.xlf | 2 +- src/Compiler/xlf/FSComp.txt.it.xlf | 2 +- src/Compiler/xlf/FSComp.txt.ja.xlf | 2 +- src/Compiler/xlf/FSComp.txt.ko.xlf | 2 +- src/Compiler/xlf/FSComp.txt.pl.xlf | 2 +- src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 2 +- src/Compiler/xlf/FSComp.txt.ru.xlf | 2 +- src/Compiler/xlf/FSComp.txt.tr.xlf | 2 +- src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 2 +- src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index 5500c3d5d6d..622f6be1990 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -7544,7 +7544,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Používá se ve vzájemně rekurzivních vazbách, v deklaracích vlastností a s několika omezeními u generických parametrů. diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index 6a4d9b3b664..c55dec6ab18 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -7544,7 +7544,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Wird in gegenseitig rekursiven Bindungen, in Eigenschaftendeklarationen und bei mehreren Beschränkungen in Bezug auf generische Parameter verwendet. diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index 398d6adb3d1..bd1f1de7d49 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -7544,7 +7544,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Se usa en enlaces mutuamente recursivos, en declaraciones de propiedad y con varias restricciones en parámetros genéricos. diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index 5fcc22f65e3..a5a62e168ab 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -7544,7 +7544,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Utilisé dans les liaisons mutuellement récursives, dans les déclarations de propriété et avec plusieurs contraintes sur des paramètres génériques. diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 52e4d991d44..5fb4ae090fe 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -7544,7 +7544,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Usata in binding ricorsivi reciproci, dichiarazioni di proprietà e con più vincoli su parametri generici. diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index 6581600dab9..3be4cc87996 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -7544,7 +7544,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + 相互に再帰的なバインディング、プロパティの宣言、およびジェネリック パラメーターの複数の制約に使用します。 diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 5cd40d56b9b..81d65a6af5c 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -7544,7 +7544,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + 상호 재귀적 바인딩과 속성 선언에 사용되며 제네릭 매개 변수의 여러 제약 조건과 함께 사용됩니다. diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index c582e51fed2..21ed12bbcfd 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -7544,7 +7544,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Używane w powiązaniach wzajemnie cyklicznych, deklaracjach właściwości oraz z wieloma ograniczeniami parametrów ogólnych. diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 85159ea6ccb..e9560020cd7 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -7544,7 +7544,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Usado em associações mutualmente recursivas, em declarações de propriedade e em múltiplas restrições em parâmetros genéricos. diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index 115749aaeb4..292b67ad38d 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -7544,7 +7544,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Используется во взаимно рекурсивных привязках, объявлениях свойств и с несколькими ограничениями для универсальных параметров. diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index 1bcc4c713a3..75b8ed962ca 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -7544,7 +7544,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Karşılıklı yinelemeli bağlamalarda, özellik bildirimlerinde ve genel parametreler üzerinde birden çok kısıtlamayla kullanılır. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index 898b9d527be..b511a5152ff 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -7544,7 +7544,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + 用于互相递归绑定、属性声明,并用于对泛型参数的多个约束。 diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index 9cd17ae1a98..f2d4f429c8f 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -7544,7 +7544,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + 用於互相遞迴的繫結、屬性宣告,以及搭配泛型參數的多個條件約束。 From 833ced71ffa4ddb6e8d1dcf8b8baf2f84d287e61 Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Mon, 10 Oct 2022 23:59:13 -0700 Subject: [PATCH 34/51] Localized file check-in by OneLocBuild Task: Build definition ID 499: Build ID 2016985 --- src/Compiler/xlf/FSComp.txt.cs.xlf | 10 ++++++++++ src/Compiler/xlf/FSComp.txt.de.xlf | 10 ++++++++++ src/Compiler/xlf/FSComp.txt.es.xlf | 10 ++++++++++ src/Compiler/xlf/FSComp.txt.fr.xlf | 10 ++++++++++ src/Compiler/xlf/FSComp.txt.it.xlf | 10 ++++++++++ src/Compiler/xlf/FSComp.txt.ja.xlf | 10 ++++++++++ src/Compiler/xlf/FSComp.txt.ko.xlf | 10 ++++++++++ src/Compiler/xlf/FSComp.txt.pl.xlf | 10 ++++++++++ src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 10 ++++++++++ src/Compiler/xlf/FSComp.txt.ru.xlf | 10 ++++++++++ src/Compiler/xlf/FSComp.txt.tr.xlf | 10 ++++++++++ src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 10 ++++++++++ src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 10 ++++++++++ 13 files changed, 130 insertions(+) diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index 622f6be1990..b78be1f6384 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -212,6 +212,11 @@ Revize kompatibility ML + + Pattern match discard is not allowed for union case that takes no data. + Pattern match discard is not allowed for union case that takes no data. + + nameof nameof @@ -402,6 +407,11 @@ Neplatný interpolovaný řetězec. V interpolovaných výrazech se nedají použít řetězcové literály s trojitými uvozovkami. Zvažte možnost použít pro interpolovaný výraz explicitní vazbu let. + + Pattern discard is not allowed for union case that takes no data. + Pattern discard is not allowed for union case that takes no data. + + This construct is deprecated. {0}. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'. Tento konstruktor je zastaralý. {0}. Tuto funkci můžete povolit pomocí parametrů --langversion:5.0 a --mlcompatibility. diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index c55dec6ab18..61b7747d4a9 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -212,6 +212,11 @@ ML-Kompatibilitätsrevisionen + + Pattern match discard is not allowed for union case that takes no data. + Pattern match discard is not allowed for union case that takes no data. + + nameof nameof @@ -402,6 +407,11 @@ Ungültige interpolierte Zeichenfolge. Zeichenfolgenliterale mit dreifachen Anführungszeichen dürfen in interpolierten Ausdrücken nicht verwendet werden. Erwägen Sie die Verwendung einer expliziten let-Bindung für den Interpolationsausdruck. + + Pattern discard is not allowed for union case that takes no data. + Pattern discard is not allowed for union case that takes no data. + + This construct is deprecated. {0}. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'. Dieses Konstrukt ist veraltet. {0}. Sie können dieses Feature mithilfe von „--langversion:5.0“ und „--mlcompatibility“ aktivieren. diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index bd1f1de7d49..65f8092313b 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -212,6 +212,11 @@ Revisiones de compatibilidad de ML + + Pattern match discard is not allowed for union case that takes no data. + Pattern match discard is not allowed for union case that takes no data. + + nameof nameof @@ -402,6 +407,11 @@ Cadena interpolada no válida. No se pueden usar literales de cadena de comillas triples en las expresiones interpoladas. Puede usar un enlace "let" explícito para la expresión de interpolación. + + Pattern discard is not allowed for union case that takes no data. + Pattern discard is not allowed for union case that takes no data. + + This construct is deprecated. {0}. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'. Esta construcción está en desuso. {0}. Puede habilitar esta característica usando '--langversion:5.0' y '--mlcompatibility'. diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index a5a62e168ab..fd8213bd466 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -212,6 +212,11 @@ Réviseurs de compatibilité ML + + Pattern match discard is not allowed for union case that takes no data. + Pattern match discard is not allowed for union case that takes no data. + + nameof nameof @@ -402,6 +407,11 @@ Chaîne interpolée non valide. Les littéraux de chaîne à guillemets triples ne peuvent pas être utilisés dans des expressions interpolées. Utilisez une liaison 'let' explicite pour l'expression d'interpolation. + + Pattern discard is not allowed for union case that takes no data. + Pattern discard is not allowed for union case that takes no data. + + This construct is deprecated. {0}. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'. Cette construction est déconseillée. {0}. Vous pouvez activer cette fonctionnalité à l’aide de'--langversion : 5.0 'et'--mlcompatibility'. diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 5fb4ae090fe..33a36a3879f 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -212,6 +212,11 @@ Revisioni della compatibilità di Ml + + Pattern match discard is not allowed for union case that takes no data. + Pattern match discard is not allowed for union case that takes no data. + + nameof nameof @@ -402,6 +407,11 @@ La stringa interpolata non è valida. Non è possibile usare valori letterali stringa tra virgolette triple in espressioni interpolate. Provare a usare un binding 'let' esplicito per l'espressione di interpolazione. + + Pattern discard is not allowed for union case that takes no data. + Pattern discard is not allowed for union case that takes no data. + + This construct is deprecated. {0}. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'. Questo costrutto è deprecato. {0}. È possibile abilitare questa funzionalità usando '--langversion:5.0' and '--mlcompatibility'. diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index 3be4cc87996..b711c9d9f3c 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -212,6 +212,11 @@ ML 互換性のリビジョン + + Pattern match discard is not allowed for union case that takes no data. + Pattern match discard is not allowed for union case that takes no data. + + nameof nameof @@ -402,6 +407,11 @@ 補間された文字列が無効です。三重引用符文字列リテラルは、補間された式では使用できません。補間式に対して明示的な 'let' バインドを使用することをご検討ください。 + + Pattern discard is not allowed for union case that takes no data. + Pattern discard is not allowed for union case that takes no data. + + This construct is deprecated. {0}. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'. このコンストラクトは使用されなくなりました。{0}。'--langversion:5.0' と '--mlcompatibility' を使用することで、この機能を有効にすることができます。 diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 81d65a6af5c..24b76ef5aef 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -212,6 +212,11 @@ ML 호환성 개정 + + Pattern match discard is not allowed for union case that takes no data. + Pattern match discard is not allowed for union case that takes no data. + + nameof nameof @@ -402,6 +407,11 @@ 잘못된 보간 문자열. 삼중 따옴표 문자열 리터럴은 보간 식에 사용할 수 없습니다. 보간 식에 명시적 'let' 바인딩을 사용해 보세요. + + Pattern discard is not allowed for union case that takes no data. + Pattern discard is not allowed for union case that takes no data. + + This construct is deprecated. {0}. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'. 이 구성은 더 이상 사용되지 않습니다. {0}. '--langversion:5.0' 및 '--mlcompatibility'를 사용하여 이 기능을 활성화할 수 있습니다. diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index 21ed12bbcfd..5c0becc87fc 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -212,6 +212,11 @@ Poprawki dotyczące zgodności Machine Learning + + Pattern match discard is not allowed for union case that takes no data. + Pattern match discard is not allowed for union case that takes no data. + + nameof nameof @@ -402,6 +407,11 @@ Nieprawidłowy ciąg interpolowany. Literały ciągów z potrójnymi cudzysłowami nie mogą być używane w wyrażeniach interpolowanych. Rozważ użycie jawnego powiązania „let” dla wyrażenia interpolacji. + + Pattern discard is not allowed for union case that takes no data. + Pattern discard is not allowed for union case that takes no data. + + This construct is deprecated. {0}. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'. Ta konstrukcja jest przestarzała. {0}. Tę funkcję można włączyć przy użyciu poleceń"--langversion:5.0" i "--mlcompatibility". diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index e9560020cd7..e278be3fb1c 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -212,6 +212,11 @@ Revisões de compatibilidade de ML + + Pattern match discard is not allowed for union case that takes no data. + Pattern match discard is not allowed for union case that takes no data. + + nameof nameof @@ -402,6 +407,11 @@ Cadeia de caracteres interpolada inválida. Literais de cadeia de caracteres de aspas triplas não podem ser usados em expressões interpoladas. Considere usar uma associação 'let' explícita para a expressão de interpolação. + + Pattern discard is not allowed for union case that takes no data. + Pattern discard is not allowed for union case that takes no data. + + This construct is deprecated. {0}. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'. Esta construção foi preterida. {0} Você pode habilitar este recurso usando '--langversion:5.0' e '--mlcompatibility'. diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index 292b67ad38d..a91ea194bad 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -212,6 +212,11 @@ Редакции совместимости ML + + Pattern match discard is not allowed for union case that takes no data. + Pattern match discard is not allowed for union case that takes no data. + + nameof nameof @@ -402,6 +407,11 @@ Недопустимая интерполированная строка. Строковые литералы с тройными кавычками запрещено использовать в интерполированных выражениях. Рекомендуется использовать явную привязку "let" для выражения интерполяции. + + Pattern discard is not allowed for union case that takes no data. + Pattern discard is not allowed for union case that takes no data. + + This construct is deprecated. {0}. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'. Эта конструкция не рекомендуется к использованию. {0}. Вы можете включить эту функцию с помощью команд "--langversion:5.0" и "--mlcompatibility". diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index 75b8ed962ca..90e5bd34ddc 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -212,6 +212,11 @@ ML uyumluluk düzeltmeleri + + Pattern match discard is not allowed for union case that takes no data. + Pattern match discard is not allowed for union case that takes no data. + + nameof nameof @@ -402,6 +407,11 @@ Geçersiz düz metin arasına kod eklenmiş dize. Üç tırnaklı dize sabitleri, düz metin arasına kod eklenmiş ifadelerde kullanılamaz. Düz metin arasına kod ekleme ifadesi için açık bir 'let' bağlaması kullanmayı düşünün. + + Pattern discard is not allowed for union case that takes no data. + Pattern discard is not allowed for union case that takes no data. + + This construct is deprecated. {0}. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'. Bu yapı kullanım dışı. {0}. Bu özelliği '--langversion:5.0' ve '--mlcompatibility' kullanarak etkinleştirebilirsiniz. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index b511a5152ff..9abff9139db 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -212,6 +212,11 @@ ML 兼容性修订 + + Pattern match discard is not allowed for union case that takes no data. + Pattern match discard is not allowed for union case that takes no data. + + nameof nameof @@ -402,6 +407,11 @@ 内插字符串无效。在内插表达式中不能使用三重引号字符串文字。请考虑对内插表达式使用显式的 "let" 绑定。 + + Pattern discard is not allowed for union case that takes no data. + Pattern discard is not allowed for union case that takes no data. + + This construct is deprecated. {0}. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'. 此构造已弃用。{0}。可以通过使用 “--langversion:5.0” 和 “--mlcompatibility” 启用此功能。 diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index f2d4f429c8f..59f18485051 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -212,6 +212,11 @@ ML 相容性修訂 + + Pattern match discard is not allowed for union case that takes no data. + Pattern match discard is not allowed for union case that takes no data. + + nameof nameof @@ -402,6 +407,11 @@ 插補字串無效。三引號字串常值不可用於插補運算式。請考慮為內插補點運算式使用明確的 'let' 繫結。 + + Pattern discard is not allowed for union case that takes no data. + Pattern discard is not allowed for union case that takes no data. + + This construct is deprecated. {0}. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'. 此建構已被取代。{0}。您可以使用 '--langversion:5.0' and '--mlcompatibility' 來啟用此功能。 From c014e59d3b18574cc9c7f72b9034a13030f1ad3d Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Tue, 11 Oct 2022 00:53:10 -0700 Subject: [PATCH 35/51] XLF --- src/Compiler/xlf/FSComp.txt.cs.xlf | 45 ------------------------- src/Compiler/xlf/FSComp.txt.de.xlf | 45 ------------------------- src/Compiler/xlf/FSComp.txt.es.xlf | 45 ------------------------- src/Compiler/xlf/FSComp.txt.fr.xlf | 45 ------------------------- src/Compiler/xlf/FSComp.txt.it.xlf | 45 ------------------------- src/Compiler/xlf/FSComp.txt.ja.xlf | 45 ------------------------- src/Compiler/xlf/FSComp.txt.ko.xlf | 45 ------------------------- src/Compiler/xlf/FSComp.txt.pl.xlf | 45 ------------------------- src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 45 ------------------------- src/Compiler/xlf/FSComp.txt.ru.xlf | 45 ------------------------- src/Compiler/xlf/FSComp.txt.tr.xlf | 45 ------------------------- src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 45 ------------------------- src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 45 ------------------------- 13 files changed, 585 deletions(-) diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index 13fff445b54..9dbc32b4b15 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -492,11 +492,6 @@ Neplatná cesta k referenčnímu sestavení - - 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' - - Specify included optimization information, the default is file. Important for distributed libraries. Zadejte zahrnuté informace o optimalizaci, výchozí hodnota je soubor. Důležité pro distribuované knihovny. @@ -3262,11 +3257,6 @@ Neočekávaný celočíselný literál ve výrazu měrné jednotky - - Syntax error: unexpected type parameter specification - Syntax error: unexpected type parameter specification - - Mismatched quotation operator name, beginning with '{0}' Neshoda v názvu operátoru citace (začíná na {0}) @@ -5212,16 +5202,6 @@ Informační soubor zdrojového odkazu, který se má vložit do souboru PDB typu Portable - - --embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - --embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - - - - --sourcelink switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - --sourcelink switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - - Source file is too large to embed in a portable PDB Zdrojový soubor je příliš velký pro vložený do souboru PDB typu Portable. @@ -6277,21 +6257,6 @@ Členové rozšíření nemůžou poskytovat přetížení operátorů. Zvažte možnost definovat místo toho operátor v definici typu. - - The name of the MDB file must be <assembly-file-name>.mdb. The --pdb option will be ignored. - The name of the MDB file must be <assembly-file-name>.mdb. The --pdb option will be ignored. - - - - MDB generation failed. Could not find compatible member {0} - MDB generation failed. Could not find compatible member {0} - - - - Cannot generate MDB debug information. Failed to load the 'MonoSymbolWriter' type from the 'Mono.CompilerServices.SymbolWriter.dll' assembly. - Cannot generate MDB debug information. Failed to load the 'MonoSymbolWriter' type from the 'Mono.CompilerServices.SymbolWriter.dll' assembly. - - The union case named '{0}' conflicts with the generated type '{1}' Případ typu union s názvem {0} koliduje s generovaným typem {1}. @@ -6567,11 +6532,6 @@ Zadaná verze {0} je {1}, ale tato hodnota představuje zástupný znak a vy jste požádali o deterministické sestavení, což je v konfliktu. - - Deterministic builds only support portable PDBs (--debug:portable or --debug:embedded) - Deterministic builds only support portable PDBs (--debug:portable or --debug:embedded) - - Character '{0}' is not allowed in provided namespace name '{1}' Znak {0} není v názvu poskytnutého oboru názvů {1} povolený. @@ -8197,11 +8157,6 @@ Mapuje fyzické cesty na názvy zdrojových cest z výstupu kompilátoru. - - --pathmap can only be used with portable PDBs (--debug:portable or --debug:embedded) - --pathmap can only be used with portable PDBs (--debug:portable or --debug:embedded) - - Invalid path map. Mappings must be comma separated and of the format 'path=sourcePath' Neplatná mapa cest. Mapování musí být oddělená čárkami a používat formát cesta=zdrojováCesta. diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index 1fb5dd43924..fcfdbb8afb0 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -492,11 +492,6 @@ Ungültiger Referenzassemblypfad" - - 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' - - Specify included optimization information, the default is file. Important for distributed libraries. Geben Sie die enthaltenen Optimierungsinformationen an, der Standardwert ist „file“. Wichtig für verteilte Bibliotheken. @@ -3262,11 +3257,6 @@ Unerwartetes Integer-Literal in Maßeinheitenausdruck. - - Syntax error: unexpected type parameter specification - Syntax error: unexpected type parameter specification - - Mismatched quotation operator name, beginning with '{0}' Anführungszeichen-Operatorname stimmt nicht überein, beginnt mit "{0}". @@ -5212,16 +5202,6 @@ Die Datei mit Informationen zur Quellverknüpfung, die in die portierbare PDB-Datei eingebettet werden soll - - --embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - --embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - - - - --sourcelink switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - --sourcelink switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - - Source file is too large to embed in a portable PDB Die Quelldatei ist zu groß, um in eine portierbare PDB eingebettet zu werden. @@ -6277,21 +6257,6 @@ Erweiterungsmember können keine Operatorüberladungen bereitstellen. Definieren Sie den Operator stattdessen als Teil der Typdefinition. - - The name of the MDB file must be <assembly-file-name>.mdb. The --pdb option will be ignored. - The name of the MDB file must be <assembly-file-name>.mdb. The --pdb option will be ignored. - - - - MDB generation failed. Could not find compatible member {0} - MDB generation failed. Could not find compatible member {0} - - - - Cannot generate MDB debug information. Failed to load the 'MonoSymbolWriter' type from the 'Mono.CompilerServices.SymbolWriter.dll' assembly. - Cannot generate MDB debug information. Failed to load the 'MonoSymbolWriter' type from the 'Mono.CompilerServices.SymbolWriter.dll' assembly. - - The union case named '{0}' conflicts with the generated type '{1}' Der Union-Fall mit dem Namen '{0}' befindet sich in einem Konflikt mit dem generierten Typ '{1}'. @@ -6567,11 +6532,6 @@ {0} hat Version "{1}" angegeben, dieser Wert ist jedoch ein Platzhalter, und Sie haben einen deterministischen Build angefordert. Zwischen diesen besteht ein Konflikt. - - Deterministic builds only support portable PDBs (--debug:portable or --debug:embedded) - Deterministic builds only support portable PDBs (--debug:portable or --debug:embedded) - - Character '{0}' is not allowed in provided namespace name '{1}' Das Zeichen '{0}' ist im angegebenen Namespacenamen '{1}' nicht zulässig. @@ -8197,11 +8157,6 @@ Ordnet der Ausgabe von Quellpfadnamen des Compilers physische Pfade zu - - --pathmap can only be used with portable PDBs (--debug:portable or --debug:embedded) - --pathmap can only be used with portable PDBs (--debug:portable or --debug:embedded) - - Invalid path map. Mappings must be comma separated and of the format 'path=sourcePath' Ungültige Pfadzuordnung. Zuordnungen müssen durch Kommas getrennt werden und das Format 'path=sourcePath' aufweisen diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index 8a03225e53d..b11d915ab39 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -492,11 +492,6 @@ Ruta de acceso de ensamblado de referencia no válida - - 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' - - Specify included optimization information, the default is file. Important for distributed libraries. Especifique la información de optimización incluida, el valor predeterminado es el archivo. Importante para las bibliotecas distribuidas. @@ -3262,11 +3257,6 @@ Literal entero inesperado en una expresión de unidad de medida. - - Syntax error: unexpected type parameter specification - Syntax error: unexpected type parameter specification - - Mismatched quotation operator name, beginning with '{0}' Falta el elemento de clausura en un nombre de operador de expresión de código delimitada que comienza con '{0}'. @@ -5212,16 +5202,6 @@ Archivo de información de vínculos de origen para insertar en el archivo PDB portable - - --embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - --embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - - - - --sourcelink switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - --sourcelink switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - - Source file is too large to embed in a portable PDB El archivo de código fuente es demasiado grande para insertarlo en un archivo PDB portable @@ -6277,21 +6257,6 @@ Los miembros de extensión no pueden proporcionar sobrecargas de operador. En su lugar, considere definir el operador como parte de la definición de tipo. - - The name of the MDB file must be <assembly-file-name>.mdb. The --pdb option will be ignored. - The name of the MDB file must be <assembly-file-name>.mdb. The --pdb option will be ignored. - - - - MDB generation failed. Could not find compatible member {0} - MDB generation failed. Could not find compatible member {0} - - - - Cannot generate MDB debug information. Failed to load the 'MonoSymbolWriter' type from the 'Mono.CompilerServices.SymbolWriter.dll' assembly. - Cannot generate MDB debug information. Failed to load the 'MonoSymbolWriter' type from the 'Mono.CompilerServices.SymbolWriter.dll' assembly. - - The union case named '{0}' conflicts with the generated type '{1}' El caso de unión denominado '{0}' entra en conflicto con el tipo generado '{1}'. @@ -6567,11 +6532,6 @@ Un objeto {0} especificó la versión "{1}", pero este valor es un carácter comodín y ha solicitado una compilación determinista. Estas opciones están en conflicto. - - Deterministic builds only support portable PDBs (--debug:portable or --debug:embedded) - Deterministic builds only support portable PDBs (--debug:portable or --debug:embedded) - - Character '{0}' is not allowed in provided namespace name '{1}' No se permite el carácter '{0}' en el nombre de espacio de nombres '{1}' proporcionado. @@ -8197,11 +8157,6 @@ Asigna rutas físicas de acceso a nombres de ruta de origen resultantes del compilador - - --pathmap can only be used with portable PDBs (--debug:portable or --debug:embedded) - --pathmap can only be used with portable PDBs (--debug:portable or --debug:embedded) - - Invalid path map. Mappings must be comma separated and of the format 'path=sourcePath' Mapa de ruta no válido. Las asignaciones deben estar separadas por comas y tener el formato "path=rutaOrigen" diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index f8d6c7fa462..cb36f32b1f0 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -492,11 +492,6 @@ Chemin d'assemblage de référence non valide' - - 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' - - Specify included optimization information, the default is file. Important for distributed libraries. Spécifiez les informations d’optimisation incluses, la valeur par défaut est le fichier. Important pour les bibliothèques distribuées. @@ -3262,11 +3257,6 @@ Littéral d'entier inattendu dans l'expression de l'unité de mesure - - Syntax error: unexpected type parameter specification - Syntax error: unexpected type parameter specification - - Mismatched quotation operator name, beginning with '{0}' Incompatibilité du nom d'opérateur de quotation, qui commence par '{0}' @@ -5212,16 +5202,6 @@ Fichier d'informations Source Link à incorporer dans le fichier PDB portable - - --embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - --embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - - - - --sourcelink switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - --sourcelink switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - - Source file is too large to embed in a portable PDB Le fichier source est trop grand pour être incorporé dans un fichier PDB portable @@ -6277,21 +6257,6 @@ Les membres d'extension ne peuvent pas fournir de surcharges d'opérateur. Définissez l'opérateur comme faisant partie de la définition de type. - - The name of the MDB file must be <assembly-file-name>.mdb. The --pdb option will be ignored. - The name of the MDB file must be <assembly-file-name>.mdb. The --pdb option will be ignored. - - - - MDB generation failed. Could not find compatible member {0} - MDB generation failed. Could not find compatible member {0} - - - - Cannot generate MDB debug information. Failed to load the 'MonoSymbolWriter' type from the 'Mono.CompilerServices.SymbolWriter.dll' assembly. - Cannot generate MDB debug information. Failed to load the 'MonoSymbolWriter' type from the 'Mono.CompilerServices.SymbolWriter.dll' assembly. - - The union case named '{0}' conflicts with the generated type '{1}' Le cas d'union nommé '{0}' est en conflit avec le type généré '{1}' @@ -6567,11 +6532,6 @@ {0} a spécifié la version '{1}', mais cette valeur est un caractère générique, et comme vous avez demandé une build déterministe, il existe un conflit. - - Deterministic builds only support portable PDBs (--debug:portable or --debug:embedded) - Deterministic builds only support portable PDBs (--debug:portable or --debug:embedded) - - Character '{0}' is not allowed in provided namespace name '{1}' Le caractère '{0}' n'est pas autorisé dans le nom d'espace de noms fourni '{1}' @@ -8197,11 +8157,6 @@ Mappe les chemins physiques aux noms de chemin source générés par le compilateur - - --pathmap can only be used with portable PDBs (--debug:portable or --debug:embedded) - --pathmap can only be used with portable PDBs (--debug:portable or --debug:embedded) - - Invalid path map. Mappings must be comma separated and of the format 'path=sourcePath' Mappage de chemin non valide. Les mappages doivent être séparés par des virgules et au format 'path=sourcePath' diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 28700690838..766e0e30348 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -492,11 +492,6 @@ Percorso assembly di riferimento non valido' - - 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' - - Specify included optimization information, the default is file. Important for distributed libraries. Specificare le informazioni di ottimizzazione incluse. Il valore predefinito è file. Important per le librerie distribuite. @@ -3262,11 +3257,6 @@ Valore letterale Integer non previsto in espressione di unità di misura - - Syntax error: unexpected type parameter specification - Syntax error: unexpected type parameter specification - - Mismatched quotation operator name, beginning with '{0}' Nome operatore di quotation non corrispondente con '{0}' iniziale @@ -5212,16 +5202,6 @@ File di informazioni sul collegamento all'origine da incorporare nel file PDB portabile - - --embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - --embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - - - - --sourcelink switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - --sourcelink switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - - Source file is too large to embed in a portable PDB Le dimensioni del file di origine sono eccessive per consentirne l'incorporamento in un PDB portabile @@ -6277,21 +6257,6 @@ I membri di estensione non possono fornire overload di operatori. Provare a definire l'operatore come parte della definizione del tipo. - - The name of the MDB file must be <assembly-file-name>.mdb. The --pdb option will be ignored. - The name of the MDB file must be <assembly-file-name>.mdb. The --pdb option will be ignored. - - - - MDB generation failed. Could not find compatible member {0} - MDB generation failed. Could not find compatible member {0} - - - - Cannot generate MDB debug information. Failed to load the 'MonoSymbolWriter' type from the 'Mono.CompilerServices.SymbolWriter.dll' assembly. - Cannot generate MDB debug information. Failed to load the 'MonoSymbolWriter' type from the 'Mono.CompilerServices.SymbolWriter.dll' assembly. - - The union case named '{0}' conflicts with the generated type '{1}' Il case di unione denominato '{0}' è in conflitto con il tipo generato '{1}' @@ -6567,11 +6532,6 @@ In un attributo {0} è stata specificata la versione '{1}', ma questo valore è un carattere jolly ed è stata richiesta una compilazione deterministica. Tali opzioni sono in conflitto. - - Deterministic builds only support portable PDBs (--debug:portable or --debug:embedded) - Deterministic builds only support portable PDBs (--debug:portable or --debug:embedded) - - Character '{0}' is not allowed in provided namespace name '{1}' Il carattere '{0}' non è consentito nel nome dello spazio dei nomi fornito '{1}' @@ -8197,11 +8157,6 @@ Esegue il mapping dei percorsi fisici ai nomi di percorso di origine restituiti dal compilatore - - --pathmap can only be used with portable PDBs (--debug:portable or --debug:embedded) - --pathmap can only be used with portable PDBs (--debug:portable or --debug:embedded) - - Invalid path map. Mappings must be comma separated and of the format 'path=sourcePath' Mapping di percorso non valido. I mapping devono essere delimitati da virgole e specificati in formato 'percorso=percorsoOrigine' diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index 31ab9348108..433aa7af0f5 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -492,11 +492,6 @@ 参照アセンブリ パスが無効です' - - 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' - - Specify included optimization information, the default is file. Important for distributed libraries. Specify included optimization information, the default is file. Important for distributed libraries. @@ -3262,11 +3257,6 @@ 単位式に予期しない整数リテラルが見つかりました - - Syntax error: unexpected type parameter specification - Syntax error: unexpected type parameter specification - - Mismatched quotation operator name, beginning with '{0}' '{0}' で始まる演算子名の引用符が対応しません @@ -5212,16 +5202,6 @@ 移植可能な PDB ファイルに埋め込むソース リンク情報ファイル - - --embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - --embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - - - - --sourcelink switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - --sourcelink switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - - Source file is too large to embed in a portable PDB ソース ファイルが大きすぎるので、移植可能な PDB 内に埋め込めません @@ -6277,21 +6257,6 @@ 拡張メンバーでは演算子のオーバーロードを実行できません。代わりに型定義の一部として演算子を定義してください。 - - The name of the MDB file must be <assembly-file-name>.mdb. The --pdb option will be ignored. - The name of the MDB file must be <assembly-file-name>.mdb. The --pdb option will be ignored. - - - - MDB generation failed. Could not find compatible member {0} - MDB generation failed. Could not find compatible member {0} - - - - Cannot generate MDB debug information. Failed to load the 'MonoSymbolWriter' type from the 'Mono.CompilerServices.SymbolWriter.dll' assembly. - Cannot generate MDB debug information. Failed to load the 'MonoSymbolWriter' type from the 'Mono.CompilerServices.SymbolWriter.dll' assembly. - - The union case named '{0}' conflicts with the generated type '{1}' {0}' という名前の共用体ケースが、生成された型 '{1}' と競合します @@ -6567,11 +6532,6 @@ {0} によりバージョン '{1}' が指定されましたが、この値はワイルドカードです。決定論的なビルドを要求しているため、これらの指定は矛盾しています。 - - Deterministic builds only support portable PDBs (--debug:portable or --debug:embedded) - Deterministic builds only support portable PDBs (--debug:portable or --debug:embedded) - - Character '{0}' is not allowed in provided namespace name '{1}' 指定された名前空間名 '{1}' には、文字 '{0}' を使用することはできません @@ -8197,11 +8157,6 @@ 物理パスをコンパイラ出力のソース パス名にマップします - - --pathmap can only be used with portable PDBs (--debug:portable or --debug:embedded) - --pathmap can only be used with portable PDBs (--debug:portable or --debug:embedded) - - Invalid path map. Mappings must be comma separated and of the format 'path=sourcePath' 無効なパス マップです。マッピングはコンマ区切りの 'path=sourcePath' 形式である必要があります diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 3e4d0dca5ce..2e326e9ecf1 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -492,11 +492,6 @@ 잘못된 참조 어셈블리 경로' - - 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' - - Specify included optimization information, the default is file. Important for distributed libraries. 포함된 최적화 정보를 지정합니다. 기본값은 파일입니다. 분산 라이브러리에 중요합니다. @@ -3262,11 +3257,6 @@ 측정 단위 식에 예기치 않은 정수 리터럴이 있습니다. - - Syntax error: unexpected type parameter specification - Syntax error: unexpected type parameter specification - - Mismatched quotation operator name, beginning with '{0}' 짝이 맞지 않는 인용구 연산자 이름('{0}'(으)로 시작)입니다. @@ -5212,16 +5202,6 @@ 이식 가능한 PDB 파일에 포함할 소스 링크 정보 파일 - - --embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - --embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - - - - --sourcelink switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - --sourcelink switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - - Source file is too large to embed in a portable PDB 소스 파일이 너무 커서 이식 가능한 PDB에 포함할 수 없습니다. @@ -6277,21 +6257,6 @@ 확장 멤버가 연산자 오버로드를 제공할 수 없습니다. 대신 연산자를 형식 정의의 일부분으로 정의하세요. - - The name of the MDB file must be <assembly-file-name>.mdb. The --pdb option will be ignored. - The name of the MDB file must be <assembly-file-name>.mdb. The --pdb option will be ignored. - - - - MDB generation failed. Could not find compatible member {0} - MDB generation failed. Could not find compatible member {0} - - - - Cannot generate MDB debug information. Failed to load the 'MonoSymbolWriter' type from the 'Mono.CompilerServices.SymbolWriter.dll' assembly. - Cannot generate MDB debug information. Failed to load the 'MonoSymbolWriter' type from the 'Mono.CompilerServices.SymbolWriter.dll' assembly. - - The union case named '{0}' conflicts with the generated type '{1}' 이름이 '{0}'인 공용 구조체가 생성된 형식 '{1}'과(와) 충돌합니다. @@ -6567,11 +6532,6 @@ {0}이(가) '{1}' 버전을 지정했지만, 이 값은 와일드카드인데 사용자가 결정적 빌드를 요청하여 문제가 발생했습니다. - - Deterministic builds only support portable PDBs (--debug:portable or --debug:embedded) - Deterministic builds only support portable PDBs (--debug:portable or --debug:embedded) - - Character '{0}' is not allowed in provided namespace name '{1}' 제공된 네임스페이스 이름 '{1}'에는 '{0}' 문자를 사용할 수 없습니다. @@ -8197,11 +8157,6 @@ 컴파일러에서 실제 경로를 소스 경로 이름 출력에 매핑합니다. - - --pathmap can only be used with portable PDBs (--debug:portable or --debug:embedded) - --pathmap can only be used with portable PDBs (--debug:portable or --debug:embedded) - - Invalid path map. Mappings must be comma separated and of the format 'path=sourcePath' 잘못된 경로 맵입니다. 매핑은 쉼표로 구분되어야 하며 'path=sourcePath' 형식이어야 합니다. diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index bc84c14ddc9..7fc1f4bbf36 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -492,11 +492,6 @@ Nieprawidłowa ścieżka zestawu odwołania“ - - 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' - - Specify included optimization information, the default is file. Important for distributed libraries. Określ dołączone informacje o optymalizacji. Wartość domyślna to plik. Ważne dla bibliotek rozproszonych. @@ -3262,11 +3257,6 @@ Nieoczekiwany literał całkowity w wyrażeniu jednostki miary - - Syntax error: unexpected type parameter specification - Syntax error: unexpected type parameter specification - - Mismatched quotation operator name, beginning with '{0}' Niezgodna nazwa operatora cytatu, począwszy od „{0}” @@ -5212,16 +5202,6 @@ Plik informacji o linku do źródła do osadzenia w przenośnym pliku PDB - - --embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - --embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - - - - --sourcelink switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - --sourcelink switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - - Source file is too large to embed in a portable PDB Plik źródłowy jest za duży, aby osadzić go w przenośnym pliku PDB @@ -6277,21 +6257,6 @@ Elementy członkowskie rozszerzeń nie mogą udostępniać przeciążeń operatorów. Zamiast tego rozważ zdefiniowanie operatora jako części definicji typu. - - The name of the MDB file must be <assembly-file-name>.mdb. The --pdb option will be ignored. - The name of the MDB file must be <assembly-file-name>.mdb. The --pdb option will be ignored. - - - - MDB generation failed. Could not find compatible member {0} - MDB generation failed. Could not find compatible member {0} - - - - Cannot generate MDB debug information. Failed to load the 'MonoSymbolWriter' type from the 'Mono.CompilerServices.SymbolWriter.dll' assembly. - Cannot generate MDB debug information. Failed to load the 'MonoSymbolWriter' type from the 'Mono.CompilerServices.SymbolWriter.dll' assembly. - - The union case named '{0}' conflicts with the generated type '{1}' Przypadek unii o nazwie „{0}” powoduje konflikt z wygenerowanym typem „{1}” @@ -6567,11 +6532,6 @@ Element {0} określił wersję „{1}”, ale wartość jest symbolem wieloznacznym. Żądano kompilacji deterministycznej. Te wartości powodują konflikt. - - Deterministic builds only support portable PDBs (--debug:portable or --debug:embedded) - Deterministic builds only support portable PDBs (--debug:portable or --debug:embedded) - - Character '{0}' is not allowed in provided namespace name '{1}' Znak „{0}” jest niedozwolony w podanej nazwie przestrzeni nazw „{1}” @@ -8197,11 +8157,6 @@ Mapuje ścieżki fizyczne na wyjściowe nazwy ścieżek źródłowych z kompilatora - - --pathmap can only be used with portable PDBs (--debug:portable or --debug:embedded) - --pathmap can only be used with portable PDBs (--debug:portable or --debug:embedded) - - Invalid path map. Mappings must be comma separated and of the format 'path=sourcePath' Nieprawidłowe mapowanie ścieżek. Mapowania muszą być rozdzielone przecinkami i mieć format „path=sourcePath” diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index e8b0bd1ca97..292cef9ae5d 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -492,11 +492,6 @@ Caminho de assembly de referência inválido' - - 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' - - Specify included optimization information, the default is file. Important for distributed libraries. Especifique as informações de otimização incluídas, o padrão é o file. Importante para bibliotecas distribuídas. @@ -3262,11 +3257,6 @@ Literal de inteiro inesperado na expressão de unidade de medida - - Syntax error: unexpected type parameter specification - Syntax error: unexpected type parameter specification - - Mismatched quotation operator name, beginning with '{0}' Nome de operador de cotação incompatível, começando com '{0}' @@ -5212,16 +5202,6 @@ O arquivo de informações do Source Link para inserir em um arquivo PDB portátil - - --embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - --embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - - - - --sourcelink switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - --sourcelink switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - - Source file is too large to embed in a portable PDB O arquivo de origem é muito grande para ser inserido em um PDB portátil @@ -6277,21 +6257,6 @@ Membros de extensão não podem fornecer sobrecargas de operadores. Considere definir o operador como parte da definição de tipo. - - The name of the MDB file must be <assembly-file-name>.mdb. The --pdb option will be ignored. - The name of the MDB file must be <assembly-file-name>.mdb. The --pdb option will be ignored. - - - - MDB generation failed. Could not find compatible member {0} - MDB generation failed. Could not find compatible member {0} - - - - Cannot generate MDB debug information. Failed to load the 'MonoSymbolWriter' type from the 'Mono.CompilerServices.SymbolWriter.dll' assembly. - Cannot generate MDB debug information. Failed to load the 'MonoSymbolWriter' type from the 'Mono.CompilerServices.SymbolWriter.dll' assembly. - - The union case named '{0}' conflicts with the generated type '{1}' O caso união chamado '{0}' conflita com o tipo gerado '{1}' @@ -6567,11 +6532,6 @@ Uma versão especificada {0} '{1}', mas esse valor é um curinga, e você solicitou uma compilação determinística. Eles estão em conflito. - - Deterministic builds only support portable PDBs (--debug:portable or --debug:embedded) - Deterministic builds only support portable PDBs (--debug:portable or --debug:embedded) - - Character '{0}' is not allowed in provided namespace name '{1}' O caractere '{0}' não é permitido no nome de namespace fornecido '{1}'. @@ -8197,11 +8157,6 @@ Mapeia caminhos físicos para nomes de caminho de origem gerados pelo compilador - - --pathmap can only be used with portable PDBs (--debug:portable or --debug:embedded) - --pathmap can only be used with portable PDBs (--debug:portable or --debug:embedded) - - Invalid path map. Mappings must be comma separated and of the format 'path=sourcePath' Mapa de caminho inválido. Os mapeamentos devem ser separados por vírgulas e do formato 'path=sourcePath' diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index f3b160dc62c..995169db4e7 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -492,11 +492,6 @@ Неверный путь к базовой сборке' - - 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' - - Specify included optimization information, the default is file. Important for distributed libraries. Укажите включенные сведения об оптимизации, по умолчанию это файл. Необходимо для распределенных библиотек. @@ -3262,11 +3257,6 @@ Недопустимый целочисленный литерал в выражении единицы измерения - - Syntax error: unexpected type parameter specification - Syntax error: unexpected type parameter specification - - Mismatched quotation operator name, beginning with '{0}' Несоответствующее имя оператора кавычки, начиная с "{0}" @@ -5212,16 +5202,6 @@ Файл со сведениями об исходной ссылке, внедряемой в переносимый PDB-файл - - --embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - --embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - - - - --sourcelink switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - --sourcelink switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - - Source file is too large to embed in a portable PDB Исходный файл слишком велик для внедрения в переносимый PDB-файл. @@ -6277,21 +6257,6 @@ Элементы расширения не могут предоставлять перегрузку операторов. Вместо этого рекомендуется определить оператор как часть определения типа. - - The name of the MDB file must be <assembly-file-name>.mdb. The --pdb option will be ignored. - The name of the MDB file must be <assembly-file-name>.mdb. The --pdb option will be ignored. - - - - MDB generation failed. Could not find compatible member {0} - MDB generation failed. Could not find compatible member {0} - - - - Cannot generate MDB debug information. Failed to load the 'MonoSymbolWriter' type from the 'Mono.CompilerServices.SymbolWriter.dll' assembly. - Cannot generate MDB debug information. Failed to load the 'MonoSymbolWriter' type from the 'Mono.CompilerServices.SymbolWriter.dll' assembly. - - The union case named '{0}' conflicts with the generated type '{1}' Ветвь объединения с именем "{0}" вступает в конфликт с созданным типом "{1}" @@ -6567,11 +6532,6 @@ Пользователь {0} указал версию "{1}", но это значение является подстановочным знаком, а вы запросили детерминированную сборку: возник конфликт. - - Deterministic builds only support portable PDBs (--debug:portable or --debug:embedded) - Deterministic builds only support portable PDBs (--debug:portable or --debug:embedded) - - Character '{0}' is not allowed in provided namespace name '{1}' Не допускается использовать символ "{0}" в указанном имени пространства имен "{1}" @@ -8197,11 +8157,6 @@ Сопоставляет физические пути с исходными путями в выходных данных компилятора - - --pathmap can only be used with portable PDBs (--debug:portable or --debug:embedded) - --pathmap can only be used with portable PDBs (--debug:portable or --debug:embedded) - - Invalid path map. Mappings must be comma separated and of the format 'path=sourcePath' Недействительная карта путей. Сопоставления должны быть разделены запятыми и должны иметь формат "path=исходный_путь" diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index 22b2bda409b..865ff430c4a 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -492,11 +492,6 @@ Geçersiz başvuru bütünleştirilmiş kodu yolu' - - 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' - - Specify included optimization information, the default is file. Important for distributed libraries. Dahil edilen iyileştirme bilgilerini belirtin; varsayılan değer dosyadır. Dağıtılmış kitaplıklar için önemlidir. @@ -3262,11 +3257,6 @@ Ölçü birimi ifadesinde beklenmeyen tamsayı sabit değeri - - Syntax error: unexpected type parameter specification - Syntax error: unexpected type parameter specification - - Mismatched quotation operator name, beginning with '{0}' '{0}' ile başlayan, eşleşmeyen alıntı işleci adı @@ -5212,16 +5202,6 @@ Taşınabilir PDB dosyasına eklenecek kaynak bağlantısı bilgileri dosyası - - --embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - --embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - - - - --sourcelink switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - --sourcelink switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - - Source file is too large to embed in a portable PDB Kaynak dosya, taşınabilir PDB dosyasına eklemek için çok büyük @@ -6277,21 +6257,6 @@ Uzantı üyeleri işleç aşırı yüklemeleri sağlayamaz. Bunun yerine işleci tür tanımının parçası olarak tanımlamayı düşünün. - - The name of the MDB file must be <assembly-file-name>.mdb. The --pdb option will be ignored. - The name of the MDB file must be <assembly-file-name>.mdb. The --pdb option will be ignored. - - - - MDB generation failed. Could not find compatible member {0} - MDB generation failed. Could not find compatible member {0} - - - - Cannot generate MDB debug information. Failed to load the 'MonoSymbolWriter' type from the 'Mono.CompilerServices.SymbolWriter.dll' assembly. - Cannot generate MDB debug information. Failed to load the 'MonoSymbolWriter' type from the 'Mono.CompilerServices.SymbolWriter.dll' assembly. - - The union case named '{0}' conflicts with the generated type '{1}' {0}' adlı birleşim durumu oluşturulan '{1}' türüyle çakışıyor @@ -6567,11 +6532,6 @@ Bir {0} tarafından '{1}' sürümü belirtildi. Ancak siz belirleyici bir derleme istediniz, bu ise bir joker karakter ve bunlar çakışıyor. - - Deterministic builds only support portable PDBs (--debug:portable or --debug:embedded) - Deterministic builds only support portable PDBs (--debug:portable or --debug:embedded) - - Character '{0}' is not allowed in provided namespace name '{1}' {1}' sağlanan ad alanı adında '{0}' karakterine izin verilmez @@ -8197,11 +8157,6 @@ Fiziksel yolları derleyiciye göre kaynak yol adları çıkışıyla eşler - - --pathmap can only be used with portable PDBs (--debug:portable or --debug:embedded) - --pathmap can only be used with portable PDBs (--debug:portable or --debug:embedded) - - Invalid path map. Mappings must be comma separated and of the format 'path=sourcePath' Geçersiz yol eşlemesi. Eşlemeler virgülle ayrılmış ve 'path=sourcePath' biçiminde olmalıdır diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index 5194522c70f..66ca6254000 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -492,11 +492,6 @@ 引用程序集路径无效 - - 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' - - Specify included optimization information, the default is file. Important for distributed libraries. 指定包含的优化信息,默认值为文件。对于分发库非常重要。 @@ -3262,11 +3257,6 @@ 度量单位表达式中意外的整数文本 - - Syntax error: unexpected type parameter specification - Syntax error: unexpected type parameter specification - - Mismatched quotation operator name, beginning with '{0}' 不匹配的引用运算符名称(以“{0}”开头) @@ -5212,16 +5202,6 @@ 要嵌入可移植 PDB 文件中的源链接信息文件 - - --embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - --embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - - - - --sourcelink switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - --sourcelink switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - - Source file is too large to embed in a portable PDB 源文件太大,无法嵌入可移植 PDB @@ -6277,21 +6257,6 @@ 扩展成员无法提供运算符重载。 请考虑改为将运算符定义为类型定义的一部分。 - - The name of the MDB file must be <assembly-file-name>.mdb. The --pdb option will be ignored. - The name of the MDB file must be <assembly-file-name>.mdb. The --pdb option will be ignored. - - - - MDB generation failed. Could not find compatible member {0} - MDB generation failed. Could not find compatible member {0} - - - - Cannot generate MDB debug information. Failed to load the 'MonoSymbolWriter' type from the 'Mono.CompilerServices.SymbolWriter.dll' assembly. - Cannot generate MDB debug information. Failed to load the 'MonoSymbolWriter' type from the 'Mono.CompilerServices.SymbolWriter.dll' assembly. - - The union case named '{0}' conflicts with the generated type '{1}' 名为“{0}”的联合用例与生成的类型“{1}”冲突 @@ -6567,11 +6532,6 @@ {0} 指定了版本“{1}”,但该值为通配符,并且你已请求确定的版本,因此存在冲突。 - - Deterministic builds only support portable PDBs (--debug:portable or --debug:embedded) - Deterministic builds only support portable PDBs (--debug:portable or --debug:embedded) - - Character '{0}' is not allowed in provided namespace name '{1}' 所提供的命名空间名称“{1}”中不允许出现字符“{0}” @@ -8197,11 +8157,6 @@ 将物理路径映射到编译器输出的源路径名 - - --pathmap can only be used with portable PDBs (--debug:portable or --debug:embedded) - --pathmap can only be used with portable PDBs (--debug:portable or --debug:embedded) - - Invalid path map. Mappings must be comma separated and of the format 'path=sourcePath' 路径映射无效。映射必须以逗号分隔,且采用 "path=sourcePath" 格式 diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index 0d93129d4be..aee1dd1ed12 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -492,11 +492,6 @@ 無效的參考組件路徑' - - 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' - - Specify included optimization information, the default is file. Important for distributed libraries. Specify included optimization information, the default is file. Important for distributed libraries. @@ -3262,11 +3257,6 @@ 測量單位運算式中未預期的整數常值 - - Syntax error: unexpected type parameter specification - Syntax error: unexpected type parameter specification - - Mismatched quotation operator name, beginning with '{0}' 不相符的引號運算子名稱,以 '{0}' 開頭 @@ -5212,16 +5202,6 @@ 要內嵌於可攜式 PDB 檔案中的來源連結資訊檔案 - - --embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - --embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - - - - --sourcelink switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - --sourcelink switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - - Source file is too large to embed in a portable PDB 來源檔案過大,無法內嵌於可攜式 PDB 中 @@ -6277,21 +6257,6 @@ 擴充成員無法提供運算子多載。請考慮將運算子改成定義為類型定義的一部分。 - - The name of the MDB file must be <assembly-file-name>.mdb. The --pdb option will be ignored. - The name of the MDB file must be <assembly-file-name>.mdb. The --pdb option will be ignored. - - - - MDB generation failed. Could not find compatible member {0} - MDB generation failed. Could not find compatible member {0} - - - - Cannot generate MDB debug information. Failed to load the 'MonoSymbolWriter' type from the 'Mono.CompilerServices.SymbolWriter.dll' assembly. - Cannot generate MDB debug information. Failed to load the 'MonoSymbolWriter' type from the 'Mono.CompilerServices.SymbolWriter.dll' assembly. - - The union case named '{0}' conflicts with the generated type '{1}' 名為 '{0}' 的聯集與產生的類型 '{1}' 衝突 @@ -6567,11 +6532,6 @@ {0} 已指定版本 '{1}',但這個值為萬用字元,且您已要求確定性組建,所以發生衝突。 - - Deterministic builds only support portable PDBs (--debug:portable or --debug:embedded) - Deterministic builds only support portable PDBs (--debug:portable or --debug:embedded) - - Character '{0}' is not allowed in provided namespace name '{1}' 提供的命名空間名稱 '{1}' 中不允許使用字元 '{0}' @@ -8197,11 +8157,6 @@ 將實體路徑對應至來源路徑名稱,由編譯器輸出 - - --pathmap can only be used with portable PDBs (--debug:portable or --debug:embedded) - --pathmap can only be used with portable PDBs (--debug:portable or --debug:embedded) - - Invalid path map. Mappings must be comma separated and of the format 'path=sourcePath' 路徑對應無效。對應必須以逗號分隔,且格式應為 'path=sourcePath' From 62e85fffa992211da6a3a567af980fb187691475 Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Tue, 11 Oct 2022 03:07:11 -0700 Subject: [PATCH 36/51] Localized file check-in by OneLocBuild Task: Build definition ID 499: Build ID 2017073 --- src/Compiler/xlf/FSComp.txt.cs.xlf | 2 +- src/Compiler/xlf/FSComp.txt.de.xlf | 2 +- src/Compiler/xlf/FSComp.txt.es.xlf | 2 +- src/Compiler/xlf/FSComp.txt.fr.xlf | 2 +- src/Compiler/xlf/FSComp.txt.it.xlf | 2 +- src/Compiler/xlf/FSComp.txt.ja.xlf | 2 +- src/Compiler/xlf/FSComp.txt.ko.xlf | 2 +- src/Compiler/xlf/FSComp.txt.pl.xlf | 2 +- src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 2 +- src/Compiler/xlf/FSComp.txt.ru.xlf | 2 +- src/Compiler/xlf/FSComp.txt.tr.xlf | 2 +- src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 2 +- src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index 9dbc32b4b15..822297d4ff9 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Používá se ve vzájemně rekurzivních vazbách, v deklaracích vlastností a s několika omezeními u generických parametrů. diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index fcfdbb8afb0..afb89b3f305 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Wird in gegenseitig rekursiven Bindungen, in Eigenschaftendeklarationen und bei mehreren Beschränkungen in Bezug auf generische Parameter verwendet. diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index b11d915ab39..7bff656b19d 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Se usa en enlaces mutuamente recursivos, en declaraciones de propiedad y con varias restricciones en parámetros genéricos. diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index cb36f32b1f0..9e4bb29ee0c 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Utilisé dans les liaisons mutuellement récursives, dans les déclarations de propriété et avec plusieurs contraintes sur des paramètres génériques. diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 766e0e30348..6e56bbe7ee8 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Usata in binding ricorsivi reciproci, dichiarazioni di proprietà e con più vincoli su parametri generici. diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index 433aa7af0f5..18b818fea07 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + 相互に再帰的なバインディング、プロパティの宣言、およびジェネリック パラメーターの複数の制約に使用します。 diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 2e326e9ecf1..052d424f56f 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + 상호 재귀적 바인딩과 속성 선언에 사용되며 제네릭 매개 변수의 여러 제약 조건과 함께 사용됩니다. diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index 7fc1f4bbf36..eb4a2819499 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Używane w powiązaniach wzajemnie cyklicznych, deklaracjach właściwości oraz z wieloma ograniczeniami parametrów ogólnych. diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 292cef9ae5d..04e91c3089b 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Usado em associações mutualmente recursivas, em declarações de propriedade e em múltiplas restrições em parâmetros genéricos. diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index 995169db4e7..29bdaf2512e 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Используется во взаимно рекурсивных привязках, объявлениях свойств и с несколькими ограничениями для универсальных параметров. diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index 865ff430c4a..4b1b2804206 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Karşılıklı yinelemeli bağlamalarda, özellik bildirimlerinde ve genel parametreler üzerinde birden çok kısıtlamayla kullanılır. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index 66ca6254000..653c27378ca 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + 用于互相递归绑定、属性声明,并用于对泛型参数的多个约束。 diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index aee1dd1ed12..781002375e3 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -7539,7 +7539,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + 用於互相遞迴的繫結、屬性宣告,以及搭配泛型參數的多個條件約束。 From fcf9a1b82f723649ae4d894eede042b099509932 Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Tue, 11 Oct 2022 10:32:32 -0700 Subject: [PATCH 37/51] Localized file check-in by OneLocBuild Task: Build definition ID 499: Build ID 2017391 --- src/Compiler/xlf/FSComp.txt.cs.xlf | 2 +- src/Compiler/xlf/FSComp.txt.de.xlf | 2 +- src/Compiler/xlf/FSComp.txt.es.xlf | 2 +- src/Compiler/xlf/FSComp.txt.fr.xlf | 2 +- src/Compiler/xlf/FSComp.txt.it.xlf | 2 +- src/Compiler/xlf/FSComp.txt.ja.xlf | 2 +- src/Compiler/xlf/FSComp.txt.ko.xlf | 2 +- src/Compiler/xlf/FSComp.txt.pl.xlf | 2 +- src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 2 +- src/Compiler/xlf/FSComp.txt.ru.xlf | 2 +- src/Compiler/xlf/FSComp.txt.tr.xlf | 2 +- src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 2 +- src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 2 +- vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.cs.xlf | 2 +- vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.de.xlf | 2 +- vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.es.xlf | 2 +- vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.fr.xlf | 2 +- vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.it.xlf | 2 +- vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ja.xlf | 2 +- vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ko.xlf | 2 +- vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pl.xlf | 2 +- vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pt-BR.xlf | 2 +- vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ru.xlf | 2 +- vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.tr.xlf | 2 +- vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hans.xlf | 2 +- vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hant.xlf | 2 +- 26 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index 86d3df0b0e6..b78be1f6384 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -7554,7 +7554,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Používá se ve vzájemně rekurzivních vazbách, v deklaracích vlastností a s několika omezeními u generických parametrů. diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index e2906712877..61b7747d4a9 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -7554,7 +7554,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Wird in gegenseitig rekursiven Bindungen, in Eigenschaftendeklarationen und bei mehreren Beschränkungen in Bezug auf generische Parameter verwendet. diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index b9eeef028f3..65f8092313b 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -7554,7 +7554,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Se usa en enlaces mutuamente recursivos, en declaraciones de propiedad y con varias restricciones en parámetros genéricos. diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index 516da922696..fd8213bd466 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -7554,7 +7554,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Utilisé dans les liaisons mutuellement récursives, dans les déclarations de propriété et avec plusieurs contraintes sur des paramètres génériques. diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 4c0f6b8045e..33a36a3879f 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -7554,7 +7554,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Usata in binding ricorsivi reciproci, dichiarazioni di proprietà e con più vincoli su parametri generici. diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index a851b0056bd..b711c9d9f3c 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -7554,7 +7554,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + 相互に再帰的なバインディング、プロパティの宣言、およびジェネリック パラメーターの複数の制約に使用します。 diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index f8aba1cd9df..24b76ef5aef 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -7554,7 +7554,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + 상호 재귀적 바인딩과 속성 선언에 사용되며 제네릭 매개 변수의 여러 제약 조건과 함께 사용됩니다. diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index 7e0ac72e64a..5c0becc87fc 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -7554,7 +7554,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Używane w powiązaniach wzajemnie cyklicznych, deklaracjach właściwości oraz z wieloma ograniczeniami parametrów ogólnych. diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index a35a4526ff4..e278be3fb1c 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -7554,7 +7554,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Usado em associações mutualmente recursivas, em declarações de propriedade e em múltiplas restrições em parâmetros genéricos. diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index e9cc08fa9cd..a91ea194bad 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -7554,7 +7554,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Используется во взаимно рекурсивных привязках, объявлениях свойств и с несколькими ограничениями для универсальных параметров. diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index bb289ebc867..90e5bd34ddc 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -7554,7 +7554,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Karşılıklı yinelemeli bağlamalarda, özellik bildirimlerinde ve genel parametreler üzerinde birden çok kısıtlamayla kullanılır. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index 6098fcbaf0c..9abff9139db 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -7554,7 +7554,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + 用于互相递归绑定、属性声明,并用于对泛型参数的多个约束。 diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index 7e9a9048b4b..59f18485051 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -7554,7 +7554,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + 用於互相遞迴的繫結、屬性宣告,以及搭配泛型參數的多個條件約束。 diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.cs.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.cs.xlf index 9bb3fc5afca..e01e2cace9d 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.cs.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.cs.xlf @@ -244,7 +244,7 @@ Lens - Lens + Lens diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.de.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.de.xlf index 78390902d29..4b3f360355f 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.de.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.de.xlf @@ -244,7 +244,7 @@ Lens - Lens + Lens diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.es.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.es.xlf index cf4755d3bd9..70f7189f9d6 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.es.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.es.xlf @@ -244,7 +244,7 @@ Lens - Lens + Lens diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.fr.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.fr.xlf index 2d217aba6b7..0098b5b9e6e 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.fr.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.fr.xlf @@ -244,7 +244,7 @@ Lens - Lens + Lens diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.it.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.it.xlf index 0a8c84d563e..5dbd6d465b0 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.it.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.it.xlf @@ -244,7 +244,7 @@ Lens - Lens + Lens diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ja.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ja.xlf index a42c056b86d..b8e577e8062 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ja.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ja.xlf @@ -244,7 +244,7 @@ Lens - Lens + Lens diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ko.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ko.xlf index 6dfde115cc9..1731bc83dce 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ko.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ko.xlf @@ -244,7 +244,7 @@ Lens - Lens + Lens diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pl.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pl.xlf index 8d64b02e369..661b9fc4bd5 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pl.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pl.xlf @@ -244,7 +244,7 @@ Lens - Lens + Lens diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pt-BR.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pt-BR.xlf index 1a5a76b6f9c..cbff3921dea 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pt-BR.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pt-BR.xlf @@ -244,7 +244,7 @@ Lens - Lens + Lens diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ru.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ru.xlf index 7192ce2bbd6..6313f17d3ff 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ru.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ru.xlf @@ -244,7 +244,7 @@ Lens - Lens + Lens diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.tr.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.tr.xlf index d6ac70f0d35..1cd6a46edc4 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.tr.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.tr.xlf @@ -244,7 +244,7 @@ Lens - Lens + Lens diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hans.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hans.xlf index 8edc31ae980..06acedd36f1 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hans.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hans.xlf @@ -244,7 +244,7 @@ Lens - Lens + Lens diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hant.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hant.xlf index 568d86c92a1..161afcb9c8e 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hant.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hant.xlf @@ -244,7 +244,7 @@ Lens - Lens + Lens From c5c32b2533c71fbec0ae298c8e2fbd0e5cf063ae Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Tue, 11 Oct 2022 10:38:25 -0700 Subject: [PATCH 38/51] Localized file check-in by OneLocBuild Task: Build definition ID 499: Build ID 2017391 --- vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf | 8 ++++---- vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf | 8 ++++---- vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf | 8 ++++---- vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf | 8 ++++---- vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf | 8 ++++---- vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf | 8 ++++---- vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf | 8 ++++---- vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf | 8 ++++---- .../src/FSharp.UIResources/xlf/Strings.pt-BR.xlf | 8 ++++---- vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf | 8 ++++---- vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf | 8 ++++---- .../src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf | 8 ++++---- .../src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf | 8 ++++---- 13 files changed, 52 insertions(+), 52 deletions(-) diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf index 465126331dd..98ae6a1efe8 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf @@ -9,22 +9,22 @@ Lens - Lens + Lens Enable Lens (Experimental) - Povolit funkci Lens (experimentální) + Enable Lens (Experimental) Annotation prefix - Předpona poznámky + Annotation prefix Use colors in annotations - Použít barvy v poznámkách + Use colors in annotations diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf index 19dbdecc591..cdde427e7b0 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf @@ -9,22 +9,22 @@ Lens - Lens + Lens Enable Lens (Experimental) - Lens aktivieren (experimentell) + Enable Lens (Experimental) Annotation prefix - Anmerkungspräfix + Annotation prefix Use colors in annotations - Farben in Anmerkungen verwenden + Use colors in annotations diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf index 593de70499a..ae6779d1f7c 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf @@ -9,22 +9,22 @@ Lens - Lens + Lens Enable Lens (Experimental) - Habilitar Lens (experimental) + Enable Lens (Experimental) Annotation prefix - Prefijo de anotación + Annotation prefix Use colors in annotations - Usar colores en anotaciones + Use colors in annotations diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf index ac9837fd02a..4f110da90a2 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf @@ -9,22 +9,22 @@ Lens - Lens + Lens Enable Lens (Experimental) - Activer Lens (expérimental) + Enable Lens (Experimental) Annotation prefix - Préfixe d'annotation + Annotation prefix Use colors in annotations - Utiliser des couleurs dans les annotations + Use colors in annotations diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf index b1cbcdc1cda..83503d30126 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf @@ -9,22 +9,22 @@ Lens - Lens + Lens Enable Lens (Experimental) - Abilita Lens (sperimentale) + Enable Lens (Experimental) Annotation prefix - Prefisso annotazione + Annotation prefix Use colors in annotations - Usa colori nelle annotazioni + Use colors in annotations diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf index 1d40d97e0e7..21955a58ffc 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf @@ -9,22 +9,22 @@ Lens - Lens + Lens Enable Lens (Experimental) - Lens を有効にする (試験段階) + Enable Lens (Experimental) Annotation prefix - 注釈のプレフィックス + Annotation prefix Use colors in annotations - 注釈でカラーを使用する + Use colors in annotations diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf index 42d4f8d5b2f..488804c4261 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf @@ -9,22 +9,22 @@ Lens - Lens + Lens Enable Lens (Experimental) - Lens 사용(실험적) + Enable Lens (Experimental) Annotation prefix - 주석 접두사 + Annotation prefix Use colors in annotations - 주석에서 색 사용 + Use colors in annotations diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf index 80c575eb707..15bf4123a08 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf @@ -9,22 +9,22 @@ Lens - Lens + Lens Enable Lens (Experimental) - Włącz funkcję Lens (eksperymentalna) + Enable Lens (Experimental) Annotation prefix - Prefiks adnotacji + Annotation prefix Use colors in annotations - Stosuj kolory w adnotacjach + Use colors in annotations diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.pt-BR.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.pt-BR.xlf index ed7bd886e92..5c446856f47 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.pt-BR.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.pt-BR.xlf @@ -9,22 +9,22 @@ Lens - Lens + Lens Enable Lens (Experimental) - Habilitar Lens (Experimental) + Enable Lens (Experimental) Annotation prefix - Prefixo da anotação + Annotation prefix Use colors in annotations - Usar cores em anotações + Use colors in annotations diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf index 2b61ff39466..6ab4d70ae12 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf @@ -9,22 +9,22 @@ Lens - Lens + Lens Enable Lens (Experimental) - Включить Lens (экспериментальная функция) + Enable Lens (Experimental) Annotation prefix - Префикс примечания + Annotation prefix Use colors in annotations - Использовать цветные примечания + Use colors in annotations diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf index 031215b1fdc..0c858cc2b97 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf @@ -9,22 +9,22 @@ Lens - Lens + Lens Enable Lens (Experimental) - Lens’i Etkinleştir (Deneysel) + Enable Lens (Experimental) Annotation prefix - Ek açıklama ön eki + Annotation prefix Use colors in annotations - Ek açıklamalarda renk kullan + Use colors in annotations diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf index f78d543557e..b2b7589c698 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf @@ -9,22 +9,22 @@ Lens - Lens + Lens Enable Lens (Experimental) - 启用 Lens (试验) + Enable Lens (Experimental) Annotation prefix - 批注前缀 + Annotation prefix Use colors in annotations - 在批注中使用颜色 + Use colors in annotations diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf index 71eac224dc4..581662f73fe 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf @@ -9,22 +9,22 @@ Lens - Lens + Lens Enable Lens (Experimental) - 啟用 Lens (實驗性) + Enable Lens (Experimental) Annotation prefix - 註釋前置詞 + Annotation prefix Use colors in annotations - 在註釋中使用色彩 + Use colors in annotations From 664588e64eff5db2a2fcb44b8dbddfb0ce4bbbf1 Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Wed, 12 Oct 2022 01:05:45 -0700 Subject: [PATCH 39/51] Localized file check-in by OneLocBuild Task: Build definition ID 499: Build ID 2018131 (#14089) --- src/Compiler/xlf/FSComp.txt.cs.xlf | 2 +- src/Compiler/xlf/FSComp.txt.de.xlf | 2 +- src/Compiler/xlf/FSComp.txt.es.xlf | 2 +- src/Compiler/xlf/FSComp.txt.fr.xlf | 2 +- src/Compiler/xlf/FSComp.txt.it.xlf | 2 +- src/Compiler/xlf/FSComp.txt.ja.xlf | 2 +- src/Compiler/xlf/FSComp.txt.ko.xlf | 2 +- src/Compiler/xlf/FSComp.txt.pl.xlf | 2 +- src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 2 +- src/Compiler/xlf/FSComp.txt.ru.xlf | 2 +- src/Compiler/xlf/FSComp.txt.tr.xlf | 5 +++-- src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 2 +- src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 2 +- 13 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index e0d6a9b8f5a..888a4cfe53e 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -374,7 +374,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Používá se ve vzájemně rekurzivních vazbách, v deklaracích vlastností a s několika omezeními u generických parametrů. diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index 1cda61a8f91..6c56fdfa8d5 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -374,7 +374,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Wird in gegenseitig rekursiven Bindungen, in Eigenschaftendeklarationen und bei mehreren Beschränkungen in Bezug auf generische Parameter verwendet. diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index 94c6dcc2ff9..d7850b578e8 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -374,7 +374,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Se usa en enlaces mutuamente recursivos, en declaraciones de propiedad y con varias restricciones en parámetros genéricos. diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index b0a5e90143c..24de79e7038 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -374,7 +374,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Utilisé dans les liaisons mutuellement récursives, dans les déclarations de propriété et avec plusieurs contraintes sur des paramètres génériques. diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 047427b9156..a75b76675e1 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -374,7 +374,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Usata in binding ricorsivi reciproci, dichiarazioni di proprietà e con più vincoli su parametri generici. diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index 58341cfee8b..63017aee6b7 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -374,7 +374,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + 相互に再帰的なバインディング、プロパティの宣言、およびジェネリック パラメーターの複数の制約に使用します。 diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 4f19ca6f22f..3d374bfac58 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -374,7 +374,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + 상호 재귀적 바인딩과 속성 선언에 사용되며 제네릭 매개 변수의 여러 제약 조건과 함께 사용됩니다. diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index 54d8d499778..511dc107e84 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -374,7 +374,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Używane w powiązaniach wzajemnie cyklicznych, deklaracjach właściwości oraz z wieloma ograniczeniami parametrów ogólnych. diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 537b8402566..a81a1ddf502 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -374,7 +374,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Usado em associações mutualmente recursivas, em declarações de propriedade e em múltiplas restrições em parâmetros genéricos. diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index 13cd7a9d0ea..e2d9593f02e 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -374,7 +374,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Используется во взаимно рекурсивных привязках, объявлениях свойств и с несколькими ограничениями для универсальных параметров. diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index cddc0c1559a..419f79f5b1a 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -374,7 +374,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + Karşılıklı yinelemeli bağlamalarda, özellik bildirimlerinde ve genel parametreler üzerinde birden çok kısıtlamayla kullanılır. @@ -515,7 +515,8 @@ The pdb output file name cannot match the build output filename use --pdb:filename.pdb pdb çıkış dosyası adı, derleme çıkış dosya adı kullanımı --pdb:filename.pdb ile eşleşmiyor - + + Produce a reference assembly, instead of a full assembly, as the primary output Birincil çıktı olarak, tam bir derleme yerine, başvuru bütünleştirilmiş kodu üretin diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index 44001ed3c7a..db25dca065c 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -374,7 +374,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + 用于互相递归绑定、属性声明,并用于对泛型参数的多个约束。 diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index 41e6735e44d..e367a57cd31 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -374,7 +374,7 @@ Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + 用於互相遞迴的繫結、屬性宣告,以及搭配泛型參數的多個條件約束。 From 525d5109e389341bb90b144c24e2ad1ceec91e7b Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Wed, 12 Oct 2022 16:33:10 +0200 Subject: [PATCH 40/51] Bugfix: Ref assemblies contained .property definitions at the wrong type in generated IL (#14093) * Bugfix: Ref assemblies contained property definitions at the wrong type * Better comment --- src/Compiler/AbstractIL/ilwrite.fs | 9 +- .../EmittedIL/ReferenceAssemblyTests.fs | 127 ++++++++++++++++-- 2 files changed, 124 insertions(+), 12 deletions(-) diff --git a/src/Compiler/AbstractIL/ilwrite.fs b/src/Compiler/AbstractIL/ilwrite.fs index 80bb791c25f..fb024b63f06 100644 --- a/src/Compiler/AbstractIL/ilwrite.fs +++ b/src/Compiler/AbstractIL/ilwrite.fs @@ -1192,7 +1192,7 @@ let canGenPropertyDef cenv (prop: ILPropertyDef) = // If we have GetMethod or SetMethod set (i.e. not None), try and see if we have MethodDefs for them. // NOTE: They can be not-None and missing MethodDefs if we skip generating them for reference assembly in the earlier pass. // Only generate property if we have at least getter or setter, otherwise, we skip. - [| prop.GetMethod; prop.SetMethod |] + [| prop.GetMethod; prop.SetMethod |] |> Array.choose id |> Array.map (TryGetMethodRefAsMethodDefIdx cenv) |> Array.exists (function | Ok _ -> true | _ -> false) @@ -1304,11 +1304,14 @@ and GenTypeDefPass2 pidx enc cenv (tdef: ILTypeDef) = // Now generate or assign index numbers for tables referenced by the maps. // Don't yet generate contents of these tables - leave that to pass3, as // code may need to embed these entries. - tdef.Implements |> List.iter (GenImplementsPass2 cenv env tidx) - props |> List.iter (GenPropertyDefPass2 cenv tidx) + tdef.Implements |> List.iter (GenImplementsPass2 cenv env tidx) events |> List.iter (GenEventDefPass2 cenv tidx) tdef.Fields.AsList() |> List.iter (GenFieldDefPass2 tdef cenv tidx) tdef.Methods |> Seq.iter (GenMethodDefPass2 tdef cenv tidx) + // Generation of property definitions for **ref assemblies** is checking existence of generated method definitions. + // Therefore, due to mutable state within "cenv", order of operations matters. + // Who could have thought that using shared mutable state can bring unexpected bugs...? + props |> List.iter (GenPropertyDefPass2 cenv tidx) tdef.NestedTypes.AsList() |> GenTypeDefsPass2 tidx (enc@[tdef.Name]) cenv with exn -> failwith ("Error in pass2 for type "+tdef.Name+", error: " + exn.Message) diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/ReferenceAssemblyTests.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/ReferenceAssemblyTests.fs index 9020c5d85e3..8f9a21364e1 100644 --- a/tests/fsharp/Compiler/CodeGen/EmittedIL/ReferenceAssemblyTests.fs +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/ReferenceAssemblyTests.fs @@ -501,6 +501,115 @@ extends [runtime]System.Object }"""] + [] + let ``Properties are emitted for CliMutable records`` () = + FSharp """ +namespace ReferenceAssembly +type [] MyRecord = { MyId: int }""" + |> withOptions ["--refonly"] + |> compile + |> shouldSucceed + |> verifyIL [ + referenceAssemblyAttributeExpectedIL + " .property instance int32 MyId()"] + + [] + let ``Properties are emitted even for CliMutable records which are not last in a file`` () = + FSharp """ +namespace ReferenceAssembly +type [] MyRecord = { MyId: int } +type [] MySecondRecord = { MySecondId: string } +""" + |> withOptions ["--refonly"] + |> compile + |> shouldSucceed + |> verifyIL [ + referenceAssemblyAttributeExpectedIL + " .property instance int32 MyId()" + " .property instance string MySecondId()"] + + [] // Regression https://github.com/dotnet/fsharp/issues/14088 . + // Generated IL was assigning properties to the last record in file instead of where they are supposed to be + let ``Properties are emitted for equal records in the same file`` () = + FSharp """ +namespace Net7FSharpSnafu.Library + +open System + +type [] MyRecord = + { Name: string } + +type [] MySecondRecord = { Name: string } +""" + |> withOptions ["--refonly"] + |> compile + |> shouldSucceed + |> verifyIL [""" .class public auto ansi serializable sealed Net7FSharpSnafu.Library.MyRecord + extends [runtime]System.Object + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CLIMutableAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoComparisonAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoEqualityAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 02 00 00 00 00 00 ) + .method public hidebysig specialname instance string + get_Name() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldnull + IL_0001: throw + } + + .method public hidebysig specialname instance void + set_Name(string 'value') cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldnull + IL_0001: throw + } + + .method public specialname rtspecialname + instance void .ctor(string name) cil managed + { + + .maxstack 8 + IL_0000: ldnull + IL_0001: throw + } + + .method public specialname rtspecialname + instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldnull + IL_0001: throw + } + + .method public strict virtual instance string + ToString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldnull + IL_0001: throw + } + + .property instance string Name() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 ) + .set instance void Net7FSharpSnafu.Library.MyRecord::set_Name(string) + .get instance string Net7FSharpSnafu.Library.MyRecord::get_Name() + } +} """] + [] let ``Properties, getters, setters are emitted for internal properties`` () = FSharp """ @@ -558,6 +667,11 @@ type MySecondaryAttribute() = IL_0001: throw } + .property instance int32 Prop1() + { + .set instance void ReferenceAssembly/MyAttribute::set_Prop1(int32) + .get instance int32 ReferenceAssembly/MyAttribute::get_Prop1() + } } .class auto ansi serializable nested public MySecondaryAttribute @@ -597,11 +711,6 @@ type MySecondaryAttribute() = IL_0001: throw } - .property instance int32 Prop1() - { - .set instance void ReferenceAssembly/MyAttribute::set_Prop1(int32) - .get instance int32 ReferenceAssembly/MyAttribute::get_Prop1() - } .property instance int32 Prop1() { .set instance void ReferenceAssembly/MySecondaryAttribute::set_Prop1(int32) @@ -805,6 +914,10 @@ type Person(name : string, age : int) = IL_0001: throw } + .property instance bool Something() + { + .get instance bool ReferenceAssembly/CustomAttribute::get_Something() + } } .class auto ansi serializable nested public Person @@ -865,10 +978,6 @@ type Person(name : string, age : int) = IL_0001: throw } - .property instance bool Something() - { - .get instance bool ReferenceAssembly/CustomAttribute::get_Something() - } .property instance string Name() { .custom instance void ReferenceAssembly/CustomAttribute::.ctor(bool) = ( 01 00 01 00 00 ) From e142005b5b992da4c04f56bdb287d685da55989c Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Thu, 13 Oct 2022 01:52:49 -0700 Subject: [PATCH 41/51] Update versions for dev17.4 (#14102) --- eng/Versions.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 544cc475da3..b021498b6bb 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -47,8 +47,8 @@ 12 - 0 - 5 + 4 + 0 $(FSRevisionVersion) $(FSToolsMajorVersion).$(FSToolsMinorVersion).$(FSToolsBuildVersion) $(FSToolsMajorVersion)-$(FSToolsMinorVersion)-$(FSToolsBuildVersion) From 5c1f59fead58805405b5f97110710a4ad67e7f1e Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Thu, 13 Oct 2022 01:58:46 -0700 Subject: [PATCH 42/51] Update versions for dev17.5 (#14100) --- eng/Versions.props | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 77ef1f20a9a..e4ead571253 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 7 0 - 0 + 1 0 @@ -40,15 +40,15 @@ $(FCSMajorVersion)$(FCSMinorVersion)$(FCSBuildVersion) - 6.0.5 + 6.0.6 $(FSCorePackageVersionValue)-$(PreReleaseVersionLabel).* 12 - 0 - 5 + 5 + 0 $(FSRevisionVersion) $(FSToolsMajorVersion).$(FSToolsMinorVersion).$(FSToolsBuildVersion) $(FSToolsMajorVersion)-$(FSToolsMinorVersion)-$(FSToolsBuildVersion) From b9053b2da2af1815c907d91051881502129bfe98 Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Thu, 13 Oct 2022 11:23:10 -0700 Subject: [PATCH 43/51] Merge main to release/dev17.5 (#14098) * Add SynType.Or. (#14058) * Add SynType.Or for generic constrains in the form (^A or ^B):... * Change ty1.Equals(ty2) to call static op_Equality (#13028) Co-authored-by: Vlad Zarytovskii Co-authored-by: Don Syme Co-authored-by: Florian Verdonck Co-authored-by: Rustam Co-authored-by: Vlad Zarytovskii Co-authored-by: Don Syme --- src/Compiler/AbstractIL/ilreflect.fs | 5 +- src/Compiler/Checking/CheckExpressions.fs | 8 +- src/Compiler/FSComp.txt | 1 + src/Compiler/Service/ServiceParseTreeWalk.fs | 3 +- src/Compiler/Service/ServiceParsedInputOps.fs | 14 +- src/Compiler/SyntaxTree/SyntaxTree.fs | 9 +- src/Compiler/SyntaxTree/SyntaxTree.fsi | 7 +- src/Compiler/SyntaxTree/SyntaxTreeOps.fs | 9 + src/Compiler/SyntaxTree/SyntaxTreeOps.fsi | 2 + src/Compiler/SyntaxTree/SyntaxTrivia.fs | 3 + src/Compiler/SyntaxTree/SyntaxTrivia.fsi | 8 + src/Compiler/TypedTree/TypeProviders.fs | 2 +- src/Compiler/Utilities/sformat.fs | 4 +- src/Compiler/Utilities/sr.fs | 2 +- src/Compiler/pars.fsy | 25 +- src/Compiler/xlf/FSComp.txt.cs.xlf | 5 + src/Compiler/xlf/FSComp.txt.de.xlf | 5 + src/Compiler/xlf/FSComp.txt.es.xlf | 5 + src/Compiler/xlf/FSComp.txt.fr.xlf | 5 + src/Compiler/xlf/FSComp.txt.it.xlf | 5 + src/Compiler/xlf/FSComp.txt.ja.xlf | 5 + src/Compiler/xlf/FSComp.txt.ko.xlf | 5 + src/Compiler/xlf/FSComp.txt.pl.xlf | 5 + src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 5 + src/Compiler/xlf/FSComp.txt.ru.xlf | 5 + src/Compiler/xlf/FSComp.txt.tr.xlf | 5 + src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 5 + src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 5 + src/FSharp.Build/FSharpEmbedResourceText.fs | 2 +- src/FSharp.Core/Linq.fs | 11 +- src/FSharp.Core/Query.fs | 44 +-- src/FSharp.Core/prim-types.fs | 319 +++++++++--------- src/FSharp.Core/quotations.fs | 2 +- src/FSharp.Core/reflect.fs | 4 +- .../FSharp.DependencyManager.fs | 2 +- ...erService.SurfaceArea.netstandard.expected | 30 +- tests/service/SyntaxTreeTests/SynTypeTests.fs | 156 +++++++++ tests/service/data/TestTP/ProvidedTypes.fs | 2 +- 38 files changed, 513 insertions(+), 226 deletions(-) diff --git a/src/Compiler/AbstractIL/ilreflect.fs b/src/Compiler/AbstractIL/ilreflect.fs index 0fc3e73e247..5cf3ec58222 100644 --- a/src/Compiler/AbstractIL/ilreflect.fs +++ b/src/Compiler/AbstractIL/ilreflect.fs @@ -412,7 +412,7 @@ module Zmap = | Some y -> y | None -> failwithf "Zmap.force: %s: x = %+A" str x -let equalTypes (s: Type) (t: Type) = s.Equals t +let equalTypes (s: Type) (t: Type) = Type.op_Equality (s, t) let equalTypeLists (tys1: Type list) (tys2: Type list) = List.lengthsEqAndForall2 equalTypes tys1 tys2 @@ -820,7 +820,8 @@ let TypeBuilderInstantiationT = ty let typeIsNotQueryable (ty: Type) = - (ty :? TypeBuilder) || ((ty.GetType()).Equals(TypeBuilderInstantiationT)) + (ty :? TypeBuilder) + || Type.op_Equality (ty.GetType(), TypeBuilderInstantiationT) let queryableTypeGetField _emEnv (parentT: Type) (fref: ILFieldRef) = let res = diff --git a/src/Compiler/Checking/CheckExpressions.fs b/src/Compiler/Checking/CheckExpressions.fs index 9e21c434270..a83ef7d669b 100644 --- a/src/Compiler/Checking/CheckExpressions.fs +++ b/src/Compiler/Checking/CheckExpressions.fs @@ -3953,7 +3953,7 @@ let rec TcTyparConstraint ridx (cenv: cenv) newOk checkConstraints occ (env: TcE | SynTypeConstraint.WhereTyparIsDelegate(tp, synTys, m) -> TcConstraintWhereTyparIsDelegate cenv env newOk checkConstraints occ tpenv tp synTys m - | SynTypeConstraint.WhereTyparSupportsMember(synSupportTys, synMemberSig, m) -> + | SynTypeConstraint.WhereTyparSupportsMember(TypesForTypar synSupportTys, synMemberSig, m) -> TcConstraintWhereTyparSupportsMember cenv env newOk tpenv synSupportTys synMemberSig m | SynTypeConstraint.WhereSelfConstrained(ty, m) -> @@ -4361,6 +4361,10 @@ and TcTypeOrMeasure kindOpt (cenv: cenv) newOk checkConstraints occ (iwsam: Warn | SynType.Paren(innerType, _) | SynType.SignatureParameter(usedType = innerType) -> TcTypeOrMeasure kindOpt cenv newOk checkConstraints occ iwsam env tpenv innerType + + | SynType.Or(range = m) -> + // The inner types are expected to be collected by (|TypesForTypar|) at this point. + error(Error((FSComp.SR.tcSynTypeOrInvalidInDeclaration()), m)) and CheckIWSAM (cenv: cenv) (env: TcEnv) checkConstraints iwsam m tcref = let g = cenv.g @@ -5651,7 +5655,7 @@ and TcExprUndelayed (cenv: cenv) (overallTy: OverallTy) env tpenv (synExpr: SynE TcNonControlFlowExpr env <| fun env -> TcExprNamedIndexPropertySet cenv overallTy env tpenv (synLongId, synExpr1, synExpr2, mStmt) - | SynExpr.TraitCall (tps, synMemberSig, arg, m) -> + | SynExpr.TraitCall (TypesForTypar tps, synMemberSig, arg, m) -> TcNonControlFlowExpr env <| fun env -> TcExprTraitCall cenv overallTy env tpenv (tps, synMemberSig, arg, m) diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index 80c356d31db..2e3267b01a7 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -1656,3 +1656,4 @@ reprStateMachineInvalidForm,"The state machine has an unexpected form" 3546,parsExpectingPatternInTuple,"Expecting pattern" 3547,parsExpectedPatternAfterToken,"Expected a pattern after this point" 3548,matchNotAllowedForUnionCaseWithNoData,"Pattern discard is not allowed for union case that takes no data." +3549,tcSynTypeOrInvalidInDeclaration,"SynType.Or is not permitted in this declaration" \ No newline at end of file diff --git a/src/Compiler/Service/ServiceParseTreeWalk.fs b/src/Compiler/Service/ServiceParseTreeWalk.fs index f3443fd95ff..274d2741365 100755 --- a/src/Compiler/Service/ServiceParseTreeWalk.fs +++ b/src/Compiler/Service/ServiceParseTreeWalk.fs @@ -821,7 +821,8 @@ module SyntaxTraversal = | SynType.WithGlobalConstraints (ty, _, _) | SynType.Array (_, ty, _) -> traverseSynType path ty | SynType.StaticConstantNamed (ty1, ty2, _) - | SynType.MeasureDivide (ty1, ty2, _) -> [ ty1; ty2 ] |> List.tryPick (traverseSynType path) + | SynType.MeasureDivide (ty1, ty2, _) + | SynType.Or (ty1, ty2, _, _) -> [ ty1; ty2 ] |> List.tryPick (traverseSynType path) | SynType.Tuple (path = segments) -> getTypeFromTuplePath segments |> List.tryPick (traverseSynType path) | SynType.StaticConstantExpr (expr, _) -> traverseSynExpr [] expr | SynType.Paren (innerType = t) diff --git a/src/Compiler/Service/ServiceParsedInputOps.fs b/src/Compiler/Service/ServiceParsedInputOps.fs index ef194965b34..3ff647478a8 100644 --- a/src/Compiler/Service/ServiceParsedInputOps.fs +++ b/src/Compiler/Service/ServiceParsedInputOps.fs @@ -607,7 +607,7 @@ module ParsedInput = | SynTypeConstraint.WhereTyparIsComparable (t, _) -> walkTypar t | SynTypeConstraint.WhereTyparIsEquatable (t, _) -> walkTypar t | SynTypeConstraint.WhereTyparSubtypeOfType (t, ty, _) -> walkTypar t |> Option.orElseWith (fun () -> walkType ty) - | SynTypeConstraint.WhereTyparSupportsMember (ts, sign, _) -> + | SynTypeConstraint.WhereTyparSupportsMember (TypesForTypar ts, sign, _) -> List.tryPick walkType ts |> Option.orElseWith (fun () -> walkMemberSig sign) | SynTypeConstraint.WhereTyparIsEnum (t, ts, _) -> walkTypar t |> Option.orElseWith (fun () -> List.tryPick walkType ts) | SynTypeConstraint.WhereTyparIsDelegate (t, ts, _) -> walkTypar t |> Option.orElseWith (fun () -> List.tryPick walkType ts) @@ -668,7 +668,8 @@ module ParsedInput = | SynType.Fun (argType = t1; returnType = t2) -> walkType t1 |> Option.orElseWith (fun () -> walkType t2) | SynType.WithGlobalConstraints (t, _, _) -> walkType t | SynType.HashConstraint (t, _) -> walkType t - | SynType.MeasureDivide (t1, t2, _) -> walkType t1 |> Option.orElseWith (fun () -> walkType t2) + | SynType.MeasureDivide (t1, t2, _) + | SynType.Or (t1, t2, _, _) -> walkType t1 |> Option.orElseWith (fun () -> walkType t2) | SynType.MeasurePower (t, _, _) -> walkType t | SynType.Paren (t, _) | SynType.SignatureParameter (usedType = t) -> walkType t @@ -838,7 +839,7 @@ module ParsedInput = | SynExpr.DoBang (e, _) -> walkExprWithKind parentKind e - | SynExpr.TraitCall (ts, sign, e, _) -> + | SynExpr.TraitCall (TypesForTypar ts, sign, e, _) -> List.tryPick walkType ts |> Option.orElseWith (fun () -> walkMemberSig sign) |> Option.orElseWith (fun () -> walkExprWithKind parentKind e) @@ -1621,7 +1622,7 @@ module ParsedInput = | SynTypeConstraint.WhereTyparIsDelegate (t, ts, _) -> walkTypar t List.iter walkType ts - | SynTypeConstraint.WhereTyparSupportsMember (ts, sign, _) -> + | SynTypeConstraint.WhereTyparSupportsMember (TypesForTypar ts, sign, _) -> List.iter walkType ts walkMemberSig sign | SynTypeConstraint.WhereSelfConstrained (ty, _) -> walkType ty @@ -1673,7 +1674,8 @@ module ParsedInput = | SynType.Paren (t, _) | SynType.SignatureParameter (usedType = t) -> walkType t | SynType.Fun (argType = t1; returnType = t2) - | SynType.MeasureDivide (t1, t2, _) -> + | SynType.MeasureDivide (t1, t2, _) + | SynType.Or (t1, t2, _, _) -> walkType t1 walkType t2 | SynType.LongIdent ident -> addLongIdentWithDots ident @@ -1820,7 +1822,7 @@ module ParsedInput = walkExpr eAndBang walkExpr e2 - | SynExpr.TraitCall (ts, sign, e, _) -> + | SynExpr.TraitCall (TypesForTypar ts, sign, e, _) -> List.iter walkType ts walkMemberSig sign walkExpr e diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fs b/src/Compiler/SyntaxTree/SyntaxTree.fs index 7ef394a67f0..051bb1e7af8 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fs +++ b/src/Compiler/SyntaxTree/SyntaxTree.fs @@ -330,7 +330,7 @@ type SynTypeConstraint = | WhereTyparSubtypeOfType of typar: SynTypar * typeName: SynType * range: range - | WhereTyparSupportsMember of typars: SynType list * memberSig: SynMemberSig * range: range + | WhereTyparSupportsMember of typars: SynType * memberSig: SynMemberSig * range: range | WhereTyparIsEnum of typar: SynTypar * typeArgs: SynType list * range: range @@ -441,6 +441,8 @@ type SynType = | SignatureParameter of attributes: SynAttributes * optional: bool * id: Ident option * usedType: SynType * range: range + | Or of lhsType: SynType * rhsType: SynType * range: range * trivia: SynTypeOrTrivia + member x.Range = match x with | SynType.App (range = m) @@ -459,7 +461,8 @@ type SynType = | SynType.MeasureDivide (range = m) | SynType.MeasurePower (range = m) | SynType.Paren (range = m) - | SynType.SignatureParameter (range = m) -> m + | SynType.SignatureParameter (range = m) + | SynType.Or (range = m) -> m | SynType.LongIdent lidwd -> lidwd.Range [] @@ -647,7 +650,7 @@ type SynExpr = | AddressOf of isByref: bool * expr: SynExpr * opRange: range * range: range - | TraitCall of supportTys: SynType list * traitSig: SynMemberSig * argExpr: SynExpr * range: range + | TraitCall of supportTys: SynType * traitSig: SynMemberSig * argExpr: SynExpr * range: range | JoinIn of lhsExpr: SynExpr * lhsRange: range * rhsExpr: SynExpr * range: range diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fsi b/src/Compiler/SyntaxTree/SyntaxTree.fsi index 8d977a4c027..4ecffe92ef4 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTree.fsi @@ -405,7 +405,7 @@ type SynTypeConstraint = | WhereTyparSubtypeOfType of typar: SynTypar * typeName: SynType * range: range /// F# syntax is ^T: (static member MemberName: ^T * int -> ^T) - | WhereTyparSupportsMember of typars: SynType list * memberSig: SynMemberSig * range: range + | WhereTyparSupportsMember of typars: SynType * memberSig: SynMemberSig * range: range /// F# syntax is 'typar: enum<'UnderlyingType> | WhereTyparIsEnum of typar: SynTypar * typeArgs: SynType list * range: range @@ -518,6 +518,9 @@ type SynType = usedType: SynType * range: range + /// F# syntax: ^a or ^b, used in trait calls + | Or of lhsType: SynType * rhsType: SynType * range: range * trivia: SynTypeOrTrivia + /// Gets the syntax range of this construct member Range: range @@ -817,7 +820,7 @@ type SynExpr = | AddressOf of isByref: bool * expr: SynExpr * opRange: range * range: range /// F# syntax: ((type1 or ... or typeN): (member-dig) expr) - | TraitCall of supportTys: SynType list * traitSig: SynMemberSig * argExpr: SynExpr * range: range + | TraitCall of supportTys: SynType * traitSig: SynMemberSig * argExpr: SynExpr * range: range /// F# syntax: ... in ... /// Computation expressions only, based on JOIN_IN token from lex filter diff --git a/src/Compiler/SyntaxTree/SyntaxTreeOps.fs b/src/Compiler/SyntaxTree/SyntaxTreeOps.fs index aefc238d10e..fda76bc0e47 100644 --- a/src/Compiler/SyntaxTree/SyntaxTreeOps.fs +++ b/src/Compiler/SyntaxTree/SyntaxTreeOps.fs @@ -1082,3 +1082,12 @@ let (|MultiDimensionArrayType|_|) (t: SynType) = else None | _ -> None + +let (|TypesForTypar|) (t: SynType) = + let rec visit continuation t = + match t with + | SynType.Paren (innerT, _) -> visit continuation innerT + | SynType.Or (lhsT, rhsT, _, _) -> visit (fun lhsTs -> [ yield! lhsTs; yield rhsT ] |> continuation) lhsT + | _ -> continuation [ t ] + + visit id t diff --git a/src/Compiler/SyntaxTree/SyntaxTreeOps.fsi b/src/Compiler/SyntaxTree/SyntaxTreeOps.fsi index b78563d4bce..bb72345971e 100644 --- a/src/Compiler/SyntaxTree/SyntaxTreeOps.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTreeOps.fsi @@ -357,3 +357,5 @@ val desugarGetSetMembers: memberDefns: SynMemberDefns -> SynMemberDefns val getTypeFromTuplePath: path: SynTupleTypeSegment list -> SynType list val (|MultiDimensionArrayType|_|): t: SynType -> (int * SynType * range) option + +val (|TypesForTypar|): t: SynType -> SynType list diff --git a/src/Compiler/SyntaxTree/SyntaxTrivia.fs b/src/Compiler/SyntaxTree/SyntaxTrivia.fs index fa4ebc784c8..7c15170e74f 100644 --- a/src/Compiler/SyntaxTree/SyntaxTrivia.fs +++ b/src/Compiler/SyntaxTree/SyntaxTrivia.fs @@ -265,3 +265,6 @@ type SynMemberGetSetTrivia = [] type SynArgPatsNamePatPairsTrivia = { ParenRange: range } + +[] +type SynTypeOrTrivia = { OrKeyword: range } diff --git a/src/Compiler/SyntaxTree/SyntaxTrivia.fsi b/src/Compiler/SyntaxTree/SyntaxTrivia.fsi index b6f0532d73c..c52cacea7b2 100644 --- a/src/Compiler/SyntaxTree/SyntaxTrivia.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTrivia.fsi @@ -384,3 +384,11 @@ type SynArgPatsNamePatPairsTrivia = /// The syntax range from the beginning of the `(` token till the end of the `)` token. ParenRange: range } + +/// Represents additional information for SynType.Or +[] +type SynTypeOrTrivia = + { + /// The syntax range of the `or` keyword + OrKeyword: range + } diff --git a/src/Compiler/TypedTree/TypeProviders.fs b/src/Compiler/TypedTree/TypeProviders.fs index 662081a1f45..02f6fafd05d 100644 --- a/src/Compiler/TypedTree/TypeProviders.fs +++ b/src/Compiler/TypedTree/TypeProviders.fs @@ -415,7 +415,7 @@ type ProvidedType (x: Type, ctxt: ProvidedTypeContext) = member _.ApplyStaticArguments(provider: ITypeProvider, fullTypePathAfterArguments, staticArgs: obj[]) = provider.ApplyStaticArguments(x, fullTypePathAfterArguments, staticArgs) |> ProvidedType.Create ctxt - member _.IsVoid = (typeof.Equals x || (x.Namespace = "System" && x.Name = "Void")) + member _.IsVoid = (Type.op_Equality(x, typeof) || (x.Namespace = "System" && x.Name = "Void")) member _.IsGenericParameter = x.IsGenericParameter diff --git a/src/Compiler/Utilities/sformat.fs b/src/Compiler/Utilities/sformat.fs index 42b13e28ff9..303e2f968b5 100644 --- a/src/Compiler/Utilities/sformat.fs +++ b/src/Compiler/Utilities/sformat.fs @@ -455,9 +455,9 @@ module ReflectUtils = isNamedType (ty1) && if ty1.IsGenericType then ty2.IsGenericType - && (ty1.GetGenericTypeDefinition()).Equals(ty2.GetGenericTypeDefinition()) + && Type.op_Equality (ty1.GetGenericTypeDefinition(), ty2.GetGenericTypeDefinition()) else - ty1.Equals(ty2) + Type.op_Equality (ty1, ty2) let option = typedefof diff --git a/src/Compiler/Utilities/sr.fs b/src/Compiler/Utilities/sr.fs index 245ed9841c2..77552a03b90 100644 --- a/src/Compiler/Utilities/sr.fs +++ b/src/Compiler/Utilities/sr.fs @@ -37,7 +37,7 @@ module internal DiagnosticMessage = let isFunctionType (ty1: System.Type) = isNamedType (ty1) && ty1.IsGenericType - && (ty1.GetGenericTypeDefinition()).Equals(funTyC) + && System.Type.op_Equality (ty1.GetGenericTypeDefinition(), funTyC) let rec destFunTy (ty: System.Type) = if isFunctionType ty then diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index 4b5888bf2f4..1dc110accee 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -2226,10 +2226,12 @@ typeConstraint: | typar COLON LPAREN classMemberSpfn rparen { let tp = $1 - SynTypeConstraint.WhereTyparSupportsMember([ SynType.Var(tp, tp.Range) ], $4, lhs parseState) } + SynTypeConstraint.WhereTyparSupportsMember(SynType.Var(tp, tp.Range), $4, lhs parseState) } | LPAREN typeAlts rparen COLON LPAREN classMemberSpfn rparen - { SynTypeConstraint.WhereTyparSupportsMember(List.rev($2), $6, lhs parseState) } + { let mParen = rhs2 parseState 1 3 + let t = SynType.Paren($2, mParen) + SynTypeConstraint.WhereTyparSupportsMember(t, $6, lhs parseState) } | typar COLON DELEGATE typeArgsNoHpaDeprecated { let _ltm, _gtm, args, _commas, mWhole = $4 @@ -2254,10 +2256,12 @@ typeConstraint: typeAlts: | typeAlts OR appType - { $3 :: $1 } + { let mOr = rhs parseState 2 + let m = unionRanges $1.Range $3.Range + SynType.Or($1, $3, m, { OrKeyword = mOr }) } | appType - { [$1] } + { $1 } /* The core of a union type definition */ unionTypeRepr: @@ -4485,17 +4489,20 @@ parenExprBody: typars: | typar - { [SynType.Var($1, rhs parseState 1)] } + { SynType.Var($1, rhs parseState 1) } - | LPAREN typarAlts rparen - { List.rev $2 } + | LPAREN typarAlts rparen + { let m = rhs2 parseState 1 3 + SynType.Paren($2, m) } typarAlts: | typarAlts OR appType - {$3 :: $1} + { let mOr = rhs parseState 2 + let m = unionRanges $1.Range $3.Range + SynType.Or($1, $3, m, { OrKeyword = mOr }) } | typar - { [SynType.Var($1, rhs parseState 1)] } + { SynType.Var($1, rhs parseState 1) } braceExpr: | LBRACE braceExprBody rbrace diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index 888a4cfe53e..291ad731c7d 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -977,6 +977,11 @@ Tento výraz implicitně převede typ {0} na typ {1}. Přečtěte si téma https://aka.ms/fsharp-implicit-convs. + + SynType.Or is not permitted in this declaration + SynType.Or is not permitted in this declaration + + The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. Vlastnost{0}vyvolaná tímto voláním má více typů podpory. Tato syntaxe volání není pro takové vlastnosti povolená. Pokyny najdete v https://aka.ms/fsharp-srtp. diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index 6c56fdfa8d5..e58a3276859 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -977,6 +977,11 @@ Dieser Ausdruck konvertiert den Typ "{0}" implizit in den Typ "{1}". Siehe https://aka.ms/fsharp-implicit-convs. + + SynType.Or is not permitted in this declaration + SynType.Or is not permitted in this declaration + + The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. Das Merkmal „{0}“, das von diesem Aufruf aufgerufen wird, weist mehrere Unterstützungstypen auf. Diese Aufrufsyntax ist für solche Merkmale nicht zulässig. Anleitungen finden Sie unter https://aka.ms/fsharp-srtp. diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index d7850b578e8..2b6e5826209 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -977,6 +977,11 @@ Esta expresión convierte implícitamente el tipo '{0}' al tipo '{1}'. Consulte https://aka.ms/fsharp-implicit-convs. + + SynType.Or is not permitted in this declaration + SynType.Or is not permitted in this declaration + + The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. El rasgo '{0}' invocado por esta llamada tiene varios tipos de soporte. No se permite esta sintaxis de invocación para estos rasgos. Consulte https://aka.ms/fsharp-srtp para obtener instrucciones. diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index 24de79e7038..64f38063f4c 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -977,6 +977,11 @@ Cette expression convertit implicitement le type « {0} » en type « {1} ». Voir https://aka.ms/fsharp-implicit-convs. + + SynType.Or is not permitted in this declaration + SynType.Or is not permitted in this declaration + + The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. La caractéristique '{0}' invoquée par cet appel a plusieurs types de prise en charge. Cette syntaxe d’appel n’est pas autorisée pour de telles caractéristiques. Consultez https://aka.ms/fsharp-srtp pour obtenir de l’aide. diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index a75b76675e1..35337e16176 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -977,6 +977,11 @@ Questa espressione converte in modo implicito il tipo '{0}' nel tipo '{1}'. Vedere https://aka.ms/fsharp-implicit-convs. + + SynType.Or is not permitted in this declaration + SynType.Or is not permitted in this declaration + + The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. Il tratto '{0}' chiamato da questa chiamata ha più tipi di supporto. Questa sintassi di chiamata non è consentita per tali tratti. Per indicazioni, vedere https://aka.ms/fsharp-srtp. diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index 63017aee6b7..55a9655cdcd 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -977,6 +977,11 @@ この式は、型 '{0}' を型 '{1}' に暗黙的に変換します。https://aka.ms/fsharp-implicit-convs を参照してください。 + + SynType.Or is not permitted in this declaration + SynType.Or is not permitted in this declaration + + The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 3d374bfac58..10f359b55f9 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -977,6 +977,11 @@ 이 식은 암시적으로 '{0}' 형식을 '{1}' 형식으로 변환 합니다. https://aka.ms/fsharp-implicit-convs 참조 + + SynType.Or is not permitted in this declaration + SynType.Or is not permitted in this declaration + + The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. 이 호출에서 호출한 '{0}' 특성에는 여러 지원 유형이 있습니다. 이러한 특성에는 이 호출 구문을 사용할 수 없습니다. 지침은 https://aka.ms/fsharp-srtp를 참조하세요. diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index 511dc107e84..708a42f3cfc 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -977,6 +977,11 @@ To wyrażenie bezwzględnie konwertuje typ "{0}" na typ "{1}". Zobacz https://aka.ms/fsharp-implicit-convs. + + SynType.Or is not permitted in this declaration + SynType.Or is not permitted in this declaration + + The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. Cecha „{0}” wywołana przez to wywołanie ma wiele typów obsługi. Ta składnia wywołania nie jest dozwolona dla takich cech. Aby uzyskać wskazówki, zobacz https://aka.ms/fsharp-srtp. diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index a81a1ddf502..9f7ac0984d3 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -977,6 +977,11 @@ Essa expressão converte implicitamente o tipo '{0}' ao tipo '{1}'. Consulte https://aka.ms/fsharp-implicit-convs. + + SynType.Or is not permitted in this declaration + SynType.Or is not permitted in this declaration + + The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. A característica '{0}' invocada por essa chamada tem vários tipos de suporte. Essa sintaxe de invocação não é permitida para essas características. Confira https://aka.ms/fsharp-srtp para obter as diretrizes. diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index e2d9593f02e..65c299291a5 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -977,6 +977,11 @@ Это выражение неявно преобразует тип "{0}" в тип "{1}". См. сведения на странице https://aka.ms/fsharp-implicit-convs. + + SynType.Or is not permitted in this declaration + SynType.Or is not permitted in this declaration + + The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. Признак "{0}", вызываемый этим звонком, имеет несколько типов поддержки. Этот синтаксис вызова не разрешен для таких признаков. См. руководство на https://aka.ms/fsharp-srtp. diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index 419f79f5b1a..3f06b53012d 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -977,6 +977,11 @@ Bu ifade '{0}' türünü örtülü olarak '{1}' türüne dönüştürür. https://aka.ms/fsharp-implicit-convs adresine bakın. + + SynType.Or is not permitted in this declaration + SynType.Or is not permitted in this declaration + + The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. Bu çağrı tarafından çağrılan '{0}' özelliği birden çok destek türüne sahiptir. Bu tür nitelikler için bu çağrı söz dizimine izin verilmez. Rehber için bkz. https://aka.ms/fsharp-srtp. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index db25dca065c..6df32617295 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -977,6 +977,11 @@ 此表达式将类型“{0}”隐式转换为类型“{1}”。请参阅 https://aka.ms/fsharp-implicit-convs。 + + SynType.Or is not permitted in this declaration + SynType.Or is not permitted in this declaration + + The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. 此调用过程调用的特征 "{0}" 具有多种支持类型。此类特征不允许使用此调用语法。有关指南,请参阅 https://aka.ms/fsharp-srtp。 diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index e367a57cd31..1b5c55a5c74 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -977,6 +977,11 @@ 此運算式將類型 '{0}' 隱含轉換為類型 '{1}'。請參閱 https://aka.ms/fsharp-implicit-convs。 + + SynType.Or is not permitted in this declaration + SynType.Or is not permitted in this declaration + + The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. The trait '{0}' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance. diff --git a/src/FSharp.Build/FSharpEmbedResourceText.fs b/src/FSharp.Build/FSharpEmbedResourceText.fs index 77002aa4f54..d8a3848ba27 100644 --- a/src/FSharp.Build/FSharpEmbedResourceText.fs +++ b/src/FSharp.Build/FSharpEmbedResourceText.fs @@ -289,7 +289,7 @@ open Printf static let isNamedType(ty:System.Type) = not (ty.IsArray || ty.IsByRef || ty.IsPointer) static let isFunctionType (ty1:System.Type) = - isNamedType(ty1) && getTypeInfo(ty1).IsGenericType && (ty1.GetGenericTypeDefinition()).Equals(funTyC) + isNamedType(ty1) && getTypeInfo(ty1).IsGenericType && System.Type.op_Equality(ty1.GetGenericTypeDefinition(), funTyC) static let rec destFunTy (ty:System.Type) = if isFunctionType ty then diff --git a/src/FSharp.Core/Linq.fs b/src/FSharp.Core/Linq.fs index 33a1dd18265..6b62eccb93e 100644 --- a/src/FSharp.Core/Linq.fs +++ b/src/FSharp.Core/Linq.fs @@ -44,9 +44,9 @@ module LeafExpressionConverter = let equivHeadTypes (ty1:Type) (ty2:Type) = isNamedType(ty1) && if ty1.IsGenericType then - ty2.IsGenericType && (ty1.GetGenericTypeDefinition()).Equals(ty2.GetGenericTypeDefinition()) + ty2.IsGenericType && Type.op_Equality(ty1.GetGenericTypeDefinition(), ty2.GetGenericTypeDefinition()) else - ty1.Equals(ty2) + Type.op_Equality(ty1, ty2) let isFunctionType typ = equivHeadTypes typ (typeof<(int -> int)>) @@ -458,7 +458,7 @@ module LeafExpressionConverter = let converted = ConvExprToLinqInContext env x // Most of conversion scenarios in C# are covered by Expression.Convert - if x.Type.Equals toTy then converted // source and target types match - do nothing + if Type.op_Equality(x.Type, toTy) then converted // source and target types match - do nothing elif not (x.Type.IsValueType || toTy.IsValueType) && toTy.IsAssignableFrom x.Type then converted // converting reference type to supertype - do nothing else Expression.Convert(converted, toTy) |> asExpr // emit Expression.Convert @@ -522,7 +522,10 @@ module LeafExpressionConverter = Expression.New(ctor, argsR, [| for p in props -> (p :> MemberInfo) |]) |> asExpr // Do the same thing as C# compiler for string addition - | PlusQ (_, GenericArgs [|ty1; ty2; ty3|], [x1; x2]) when ty1 = typeof && ty2 = typeof && ty3 = typeof -> + | PlusQ (_, GenericArgs [|ty1; ty2; ty3|], [x1; x2]) + when Type.op_Equality(ty1, typeof) && + Type.op_Equality(ty2, typeof) && + Type.op_Equality(ty3, typeof) -> Expression.Add(ConvExprToLinqInContext env x1, ConvExprToLinqInContext env x2, StringConcat) |> asExpr // LanguagePrimitives.PhysicalEquality's generic constraint of both sides being the same reference type is already sufficient for Linq Expressions' requirements diff --git a/src/FSharp.Core/Query.fs b/src/FSharp.Core/Query.fs index ae11d3835a1..28a460619f6 100644 --- a/src/FSharp.Core/Query.fs +++ b/src/FSharp.Core/Query.fs @@ -440,7 +440,7 @@ module Query = let IsIEnumerableTy (ty: System.Type) = ty.IsGenericType && ty.GetGenericTypeDefinition() = IEnumerableTypeDef // Check a tag type on QuerySource is IQueryable - let qTyIsIQueryable (ty : System.Type) = not (ty.Equals(typeof)) + let qTyIsIQueryable (ty : System.Type) = not (Type.op_Equality(ty, typeof)) let FuncExprToDelegateExpr (srcTy, targetTy, v, body) = Expr.NewDelegate (Linq.Expressions.Expression.GetFuncType [| srcTy; targetTy |], [v], body) @@ -588,21 +588,21 @@ module Query = let selector = MakeImplicitExpressionConversion selector let maker = match resTyNoNullable with - | ty when ty = typeof -> mq_double - | ty when ty = typeof -> mq_single - | ty when ty = typeof -> mq_decimal - | ty when ty = typeof -> mq_int32 - | ty when ty = typeof -> mq_int64 + | ty when Type.op_Equality(ty, typeof) -> mq_double + | ty when Type.op_Equality(ty, typeof) -> mq_single + | ty when Type.op_Equality(ty, typeof) -> mq_decimal + | ty when Type.op_Equality(ty, typeof) -> mq_int32 + | ty when Type.op_Equality(ty, typeof) -> mq_int64 | _ -> failDueToUnsupportedInputTypeInSumByOrAverageBy() maker ([srcItemTy], [src; selector]) else // Try to dynamically invoke a LINQ method if one exists, since these may be optimized over arrays etc. match resTyNoNullable with - | ty when ty = typeof -> me_double ([srcItemTy], [src; selector]) - | ty when ty = typeof -> me_single ([srcItemTy], [src; selector]) - | ty when ty = typeof -> me_decimal ([srcItemTy], [src; selector]) - | ty when ty = typeof -> me_int32 ([srcItemTy], [src; selector]) - | ty when ty = typeof -> me_int64 ([srcItemTy], [src; selector]) + | ty when Type.op_Equality(ty, typeof) -> me_double ([srcItemTy], [src; selector]) + | ty when Type.op_Equality(ty, typeof) -> me_single ([srcItemTy], [src; selector]) + | ty when Type.op_Equality(ty, typeof) -> me_decimal ([srcItemTy], [src; selector]) + | ty when Type.op_Equality(ty, typeof) -> me_int32 ([srcItemTy], [src; selector]) + | ty when Type.op_Equality(ty, typeof) -> me_int64 ([srcItemTy], [src; selector]) | _ -> // The F# implementation needs a QuerySource as a parameter. let qTy = typeof @@ -617,22 +617,22 @@ module Query = let selector = FuncExprToLinqFunc2Expression (srcItemTy, resTy, v, res) let caller = match resTyNoNullable with - | ty when ty = typeof -> cq_double - | ty when ty = typeof -> cq_single - | ty when ty = typeof -> cq_decimal - | ty when ty = typeof -> cq_int32 - | ty when ty = typeof -> cq_int64 + | ty when Type.op_Equality(ty, typeof) -> cq_double + | ty when Type.op_Equality(ty, typeof) -> cq_single + | ty when Type.op_Equality(ty, typeof) -> cq_decimal + | ty when Type.op_Equality(ty, typeof) -> cq_int32 + | ty when Type.op_Equality(ty, typeof) -> cq_int64 | _ -> failDueToUnsupportedInputTypeInSumByOrAverageBy() caller ([srcItemTy], [src; box selector]) : obj else // Try to dynamically invoke a LINQ method if one exists, since these may be optimized over arrays etc. let linqMethOpt = match resTyNoNullable with - | ty when ty = typeof -> Some ce_double - | ty when ty = typeof -> Some ce_single - | ty when ty = typeof -> Some ce_decimal - | ty when ty = typeof -> Some ce_int32 - | ty when ty = typeof -> Some ce_int64 + | ty when Type.op_Equality(ty, typeof) -> Some ce_double + | ty when Type.op_Equality(ty, typeof) -> Some ce_single + | ty when Type.op_Equality(ty, typeof) -> Some ce_decimal + | ty when Type.op_Equality(ty, typeof) -> Some ce_int32 + | ty when Type.op_Equality(ty, typeof) -> Some ce_int64 | _ -> None match linqMethOpt with | Some ce -> @@ -1617,7 +1617,7 @@ module Query = let IQueryableTySpec = MakeIQueryableTy tyArg // if result type of nested query is derived from IQueryable but not IQueryable itself (i.e. IOrderedQueryable) // then add coercion to IQueryable so result type will match expected signature of QuerySource.Run - if (IQueryableTySpec.IsAssignableFrom replNestedQuery.Type) && not (IQueryableTySpec.Equals replNestedQuery.Type) then + if (IQueryableTySpec.IsAssignableFrom replNestedQuery.Type) && not (Type.op_Equality(IQueryableTySpec, replNestedQuery.Type)) then Expr.Coerce (replNestedQuery, IQueryableTySpec) else replNestedQuery diff --git a/src/FSharp.Core/prim-types.fs b/src/FSharp.Core/prim-types.fs index 0489528c062..85befedcb4b 100644 --- a/src/FSharp.Core/prim-types.fs +++ b/src/FSharp.Core/prim-types.fs @@ -606,7 +606,7 @@ namespace Microsoft.FSharp.Core then TypeNullnessSemantics_NullNever else if not (typeof<'T>.IsDefined(typeof, false)) then TypeNullnessSemantics_NullIsExtraValue - elif typeof<'T>.Equals(typeof) then + elif Type.op_Equality (typeof<'T>, typeof) then TypeNullnessSemantics_NullTrueValue elif typeof.IsAssignableFrom(typeof<'T>) then TypeNullnessSemantics_NullIsExtraValue @@ -2098,22 +2098,22 @@ namespace Microsoft.FSharp.Core type FastGenericEqualityComparerTable<'T>() = static let f : IEqualityComparer<'T> = match typeof<'T> with - | ty when ty.Equals(typeof) -> unboxPrim (box BoolIEquality) - | ty when ty.Equals(typeof) -> unboxPrim (box ByteIEquality) - | ty when ty.Equals(typeof) -> unboxPrim (box Int32IEquality) - | ty when ty.Equals(typeof) -> unboxPrim (box UInt32IEquality) - | ty when ty.Equals(typeof) -> unboxPrim (box CharIEquality) - | ty when ty.Equals(typeof) -> unboxPrim (box SByteIEquality) - | ty when ty.Equals(typeof) -> unboxPrim (box Int16IEquality) - | ty when ty.Equals(typeof) -> unboxPrim (box Int64IEquality) - | ty when ty.Equals(typeof) -> unboxPrim (box IntPtrIEquality) - | ty when ty.Equals(typeof) -> unboxPrim (box UInt16IEquality) - | ty when ty.Equals(typeof) -> unboxPrim (box UInt64IEquality) - | ty when ty.Equals(typeof) -> unboxPrim (box UIntPtrIEquality) - | ty when ty.Equals(typeof) -> unboxPrim (box FloatIEquality) - | ty when ty.Equals(typeof) -> unboxPrim (box Float32IEquality) - | ty when ty.Equals(typeof) -> unboxPrim (box DecimalIEquality) - | ty when ty.Equals(typeof) -> unboxPrim (box StringIEquality) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box BoolIEquality) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box ByteIEquality) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box Int32IEquality) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box UInt32IEquality) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box CharIEquality) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box SByteIEquality) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box Int16IEquality) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box Int64IEquality) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box IntPtrIEquality) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box UInt16IEquality) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box UInt64IEquality) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box UIntPtrIEquality) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box FloatIEquality) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box Float32IEquality) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box DecimalIEquality) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box StringIEquality) | _ -> MakeGenericEqualityComparer<'T>() static member Function : IEqualityComparer<'T> = f @@ -2193,42 +2193,42 @@ namespace Microsoft.FSharp.Core // REVIEW: in a future version we could extend this to include additional types static let fCanBeNull : IComparer<'T> = match typeof<'T> with - | ty when ty.Equals(typeof) -> unboxPrim (box IntPtrComparer) - | ty when ty.Equals(typeof) -> unboxPrim (box UIntPtrComparer) - | ty when ty.Equals(typeof) -> null - | ty when ty.Equals(typeof) -> null - | ty when ty.Equals(typeof) -> null - | ty when ty.Equals(typeof) -> null - | ty when ty.Equals(typeof) -> null - | ty when ty.Equals(typeof) -> null - | ty when ty.Equals(typeof) -> null - | ty when ty.Equals(typeof) -> null - | ty when ty.Equals(typeof) -> null - | ty when ty.Equals(typeof) -> null - | ty when ty.Equals(typeof) -> null - | ty when ty.Equals(typeof) -> null - | ty when ty.Equals(typeof) -> unboxPrim (box StringComparer) - | ty when ty.Equals(typeof) -> null + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box IntPtrComparer) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box UIntPtrComparer) + | ty when Type.op_Equality(ty, typeof) -> null + | ty when Type.op_Equality(ty, typeof) -> null + | ty when Type.op_Equality(ty, typeof) -> null + | ty when Type.op_Equality(ty, typeof) -> null + | ty when Type.op_Equality(ty, typeof) -> null + | ty when Type.op_Equality(ty, typeof) -> null + | ty when Type.op_Equality(ty, typeof) -> null + | ty when Type.op_Equality(ty, typeof) -> null + | ty when Type.op_Equality(ty, typeof) -> null + | ty when Type.op_Equality(ty, typeof) -> null + | ty when Type.op_Equality(ty, typeof) -> null + | ty when Type.op_Equality(ty, typeof) -> null + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box StringComparer) + | ty when Type.op_Equality(ty, typeof) -> null | _ -> MakeGenericComparer<'T>() static let f : IComparer<'T> = match typeof<'T> with - | ty when ty.Equals(typeof) -> unboxPrim (box ByteComparer) - | ty when ty.Equals(typeof) -> unboxPrim (box CharComparer) - | ty when ty.Equals(typeof) -> unboxPrim (box SByteComparer) - | ty when ty.Equals(typeof) -> unboxPrim (box Int16Comparer) - | ty when ty.Equals(typeof) -> unboxPrim (box Int32Comparer) - | ty when ty.Equals(typeof) -> unboxPrim (box Int64Comparer) - | ty when ty.Equals(typeof) -> unboxPrim (box IntPtrComparer) - | ty when ty.Equals(typeof) -> unboxPrim (box UInt16Comparer) - | ty when ty.Equals(typeof) -> unboxPrim (box UInt32Comparer) - | ty when ty.Equals(typeof) -> unboxPrim (box UInt64Comparer) - | ty when ty.Equals(typeof) -> unboxPrim (box UIntPtrComparer) - | ty when ty.Equals(typeof) -> unboxPrim (box FloatComparer) - | ty when ty.Equals(typeof) -> unboxPrim (box Float32Comparer) - | ty when ty.Equals(typeof) -> unboxPrim (box DecimalComparer) - | ty when ty.Equals(typeof) -> unboxPrim (box StringComparer) - | ty when ty.Equals(typeof) -> unboxPrim (box BoolComparer) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box ByteComparer) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box CharComparer) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box SByteComparer) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box Int16Comparer) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box Int32Comparer) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box Int64Comparer) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box IntPtrComparer) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box UInt16Comparer) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box UInt32Comparer) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box UInt64Comparer) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box UIntPtrComparer) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box FloatComparer) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box Float32Comparer) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box DecimalComparer) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box StringComparer) + | ty when Type.op_Equality(ty, typeof) -> unboxPrim (box BoolComparer) | _ -> // Review: There are situations where we should be able // to return Generic.Comparer<'T>.Default here. @@ -2450,46 +2450,46 @@ namespace Microsoft.FSharp.Core type GenericZeroDynamicImplTable<'T>() = static let result : 'T = // The dynamic implementation - let aty = typeof<'T> - if aty.Equals(typeof) then unboxPrim<'T> (box 0y) - elif aty.Equals(typeof) then unboxPrim<'T> (box 0s) - elif aty.Equals(typeof) then unboxPrim<'T> (box 0) - elif aty.Equals(typeof) then unboxPrim<'T> (box 0L) - elif aty.Equals(typeof) then unboxPrim<'T> (box 0n) - elif aty.Equals(typeof) then unboxPrim<'T> (box 0uy) - elif aty.Equals(typeof) then unboxPrim<'T> (box 0us) - elif aty.Equals(typeof) then unboxPrim<'T> (box '\000') - elif aty.Equals(typeof) then unboxPrim<'T> (box 0u) - elif aty.Equals(typeof) then unboxPrim<'T> (box 0UL) - elif aty.Equals(typeof) then unboxPrim<'T> (box 0un) - elif aty.Equals(typeof) then unboxPrim<'T> (box 0M) - elif aty.Equals(typeof) then unboxPrim<'T> (box 0.0) - elif aty.Equals(typeof) then unboxPrim<'T> (box 0.0f) + let ty = typeof<'T> + if Type.op_Equality(ty, typeof) then unboxPrim<'T> (box 0y) + elif Type.op_Equality(ty, typeof) then unboxPrim<'T> (box 0s) + elif Type.op_Equality(ty, typeof) then unboxPrim<'T> (box 0) + elif Type.op_Equality(ty, typeof) then unboxPrim<'T> (box 0L) + elif Type.op_Equality(ty, typeof) then unboxPrim<'T> (box 0n) + elif Type.op_Equality(ty, typeof) then unboxPrim<'T> (box 0uy) + elif Type.op_Equality(ty, typeof) then unboxPrim<'T> (box 0us) + elif Type.op_Equality(ty, typeof) then unboxPrim<'T> (box '\000') + elif Type.op_Equality(ty, typeof) then unboxPrim<'T> (box 0u) + elif Type.op_Equality(ty, typeof) then unboxPrim<'T> (box 0UL) + elif Type.op_Equality(ty, typeof) then unboxPrim<'T> (box 0un) + elif Type.op_Equality(ty, typeof) then unboxPrim<'T> (box 0M) + elif Type.op_Equality(ty, typeof) then unboxPrim<'T> (box 0.0) + elif Type.op_Equality(ty, typeof) then unboxPrim<'T> (box 0.0f) else - let pinfo = aty.GetProperty("Zero") + let pinfo = ty.GetProperty("Zero") unboxPrim<'T> (pinfo.GetValue(null,null)) static member Result : 'T = result type GenericOneDynamicImplTable<'T>() = static let result : 'T = // The dynamic implementation - let aty = typeof<'T> - if aty.Equals(typeof) then unboxPrim<'T> (box 1y) - elif aty.Equals(typeof) then unboxPrim<'T> (box 1s) - elif aty.Equals(typeof) then unboxPrim<'T> (box 1) - elif aty.Equals(typeof) then unboxPrim<'T> (box 1L) - elif aty.Equals(typeof) then unboxPrim<'T> (box 1n) - elif aty.Equals(typeof) then unboxPrim<'T> (box 1uy) - elif aty.Equals(typeof) then unboxPrim<'T> (box 1us) - elif aty.Equals(typeof) then unboxPrim<'T> (box '\001') - elif aty.Equals(typeof) then unboxPrim<'T> (box 1u) - elif aty.Equals(typeof) then unboxPrim<'T> (box 1UL) - elif aty.Equals(typeof) then unboxPrim<'T> (box 1un) - elif aty.Equals(typeof) then unboxPrim<'T> (box 1M) - elif aty.Equals(typeof) then unboxPrim<'T> (box 1.0) - elif aty.Equals(typeof) then unboxPrim<'T> (box 1.0f) + let ty = typeof<'T> + if Type.op_Equality(ty, typeof) then unboxPrim<'T> (box 1y) + elif Type.op_Equality(ty, typeof) then unboxPrim<'T> (box 1s) + elif Type.op_Equality(ty, typeof) then unboxPrim<'T> (box 1) + elif Type.op_Equality(ty, typeof) then unboxPrim<'T> (box 1L) + elif Type.op_Equality(ty, typeof) then unboxPrim<'T> (box 1n) + elif Type.op_Equality(ty, typeof) then unboxPrim<'T> (box 1uy) + elif Type.op_Equality(ty, typeof) then unboxPrim<'T> (box 1us) + elif Type.op_Equality(ty, typeof) then unboxPrim<'T> (box '\001') + elif Type.op_Equality(ty, typeof) then unboxPrim<'T> (box 1u) + elif Type.op_Equality(ty, typeof) then unboxPrim<'T> (box 1UL) + elif Type.op_Equality(ty, typeof) then unboxPrim<'T> (box 1un) + elif Type.op_Equality(ty, typeof) then unboxPrim<'T> (box 1M) + elif Type.op_Equality(ty, typeof) then unboxPrim<'T> (box 1.0) + elif Type.op_Equality(ty, typeof) then unboxPrim<'T> (box 1.0f) else - let pinfo = aty.GetProperty("One") + let pinfo = ty.GetProperty("One") unboxPrim<'T> (pinfo.GetValue(null,null)) static member Result : 'T = result @@ -2604,7 +2604,7 @@ namespace Microsoft.FSharp.Core let ameth = aty.GetSingleStaticMethodByTypes(opName, [| aty; bty |]) let bmeth = - if aty.Equals(bty) then null else + if Type.op_Equality(aty, bty) then null else bty.GetSingleStaticMethodByTypes(opName, [| aty; bty |]) match ameth, bmeth with | null, null -> raise (NotSupportedException (SR.GetString(SR.dyInvOpAddCoerce))) @@ -4175,7 +4175,7 @@ namespace Microsoft.FSharp.Core let Failure message = new Exception(message) [] - let (|Failure|_|) (error: exn) = if error.GetType().Equals(typeof) then Some error.Message else None + let (|Failure|_|) (error: exn) = if Type.op_Equality(error.GetType(), typeof) then Some error.Message else None let inline (<) x y = GenericLessThan x y @@ -5002,7 +5002,7 @@ namespace Microsoft.FSharp.Core when ^T : string = not (# "clt" (String.CompareOrdinal((# "" x : string #),(# "" y : string #))) 0 : bool #) when ^T : ^T = ((^T or ^U): (static member (>=) : ^T * ^U -> bool) (x,y)) - /// Static greater-than-or-equal with static optimizations for some well-known cases. + /// Static equal with static optimizations for some well-known cases. let inline (=) (x:^T) (y:^T) = EqualityDynamic<(^T), (^T), bool> x y when ^T : bool = (# "ceq" x y : bool #) @@ -5023,6 +5023,7 @@ namespace Microsoft.FSharp.Core when ^T : decimal = Decimal.op_Equality((# "" x:decimal #), (# "" y:decimal #)) when ^T : ^T = (^T : (static member (=) : ^T * ^T -> bool) (x,y)) + /// Static unequal with static optimizations for some well-known cases. let inline (<>) (x:^T) (y:^T) = InequalityDynamic<(^T), (^T), bool> x y when ^T : bool = not (# "ceq" x y : bool #) @@ -6472,181 +6473,181 @@ namespace Microsoft.FSharp.Core type AbsDynamicImplTable<'T>() = static let result : ('T -> 'T) = - let aty = typeof<'T> - if aty.Equals(typeof) then unboxPrim<_>(fun (x:sbyte) -> absImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:int16) -> absImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:int32) -> absImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:int64) -> absImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:nativeint) -> absImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:float) -> absImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:float32) -> absImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:decimal) -> absImpl x) + let ty = typeof<'T> + if Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:sbyte) -> absImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:int16) -> absImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:int32) -> absImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:int64) -> absImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:nativeint) -> absImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float) -> absImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float32) -> absImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:decimal) -> absImpl x) else UnaryDynamicImpl "Abs" static member Result : ('T -> 'T) = result type AcosDynamicImplTable<'T>() = static let result : ('T -> 'T) = - let aty = typeof<'T> - if aty.Equals(typeof) then unboxPrim<_>(fun (x:float) -> acosImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:float32) -> acosImpl x) + let ty = typeof<'T> + if Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float) -> acosImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float32) -> acosImpl x) else UnaryDynamicImpl "Acos" static member Result : ('T -> 'T) = result type AsinDynamicImplTable<'T>() = static let result : ('T -> 'T) = - let aty = typeof<'T> - if aty.Equals(typeof) then unboxPrim<_>(fun (x:float) -> asinImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:float32) -> asinImpl x) + let ty = typeof<'T> + if Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float) -> asinImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float32) -> asinImpl x) else UnaryDynamicImpl "Asin" static member Result : ('T -> 'T) = result type AtanDynamicImplTable<'T>() = static let result : ('T -> 'T) = - let aty = typeof<'T> - if aty.Equals(typeof) then unboxPrim<_>(fun (x:float) -> atanImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:float32) -> atanImpl x) + let ty = typeof<'T> + if Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float) -> atanImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float32) -> atanImpl x) else UnaryDynamicImpl "Atan" static member Result : ('T -> 'T) = result type Atan2DynamicImplTable<'T,'U>() = static let result : ('T -> 'T -> 'U) = - let aty = typeof<'T> - if aty.Equals(typeof) then unboxPrim<_>(fun (x:float) (y:float) -> atan2Impl x y) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:float32) (y:float32) -> atan2Impl x y) + let ty = typeof<'T> + if Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float) (y:float) -> atan2Impl x y) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float32) (y:float32) -> atan2Impl x y) else BinaryDynamicImpl "Atan2" static member Result : ('T -> 'T -> 'U) = result type CeilingDynamicImplTable<'T>() = static let result : ('T -> 'T) = - let aty = typeof<'T> - if aty.Equals(typeof) then unboxPrim<_>(fun (x:float) -> ceilImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:float32) -> ceilImpl x) + let ty = typeof<'T> + if Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float) -> ceilImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float32) -> ceilImpl x) else UnaryDynamicImpl "Ceiling" static member Result : ('T -> 'T) = result type ExpDynamicImplTable<'T>() = static let result : ('T -> 'T) = - let aty = typeof<'T> - if aty.Equals(typeof) then unboxPrim<_>(fun (x:float) -> expImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:float32) -> expImpl x) + let ty = typeof<'T> + if Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float) -> expImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float32) -> expImpl x) else UnaryDynamicImpl "Exp" static member Result : ('T -> 'T) = result type FloorDynamicImplTable<'T>() = static let result : ('T -> 'T) = - let aty = typeof<'T> - if aty.Equals(typeof) then unboxPrim<_>(fun (x:float) -> floorImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:float32) -> floorImpl x) + let ty = typeof<'T> + if Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float) -> floorImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float32) -> floorImpl x) else UnaryDynamicImpl "Floor" static member Result : ('T -> 'T) = result type TruncateDynamicImplTable<'T>() = static let result : ('T -> 'T) = - let aty = typeof<'T> - if aty.Equals(typeof) then unboxPrim<_>(fun (x:float) -> truncateImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:float32) -> truncateImpl x) + let ty = typeof<'T> + if Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float) -> truncateImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float32) -> truncateImpl x) else UnaryDynamicImpl "Truncate" static member Result : ('T -> 'T) = result type RoundDynamicImplTable<'T>() = static let result : ('T -> 'T) = - let aty = typeof<'T> - if aty.Equals(typeof) then unboxPrim<_>(fun (x:float) -> roundImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:float32) -> roundImpl x) + let ty = typeof<'T> + if Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float) -> roundImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float32) -> roundImpl x) else UnaryDynamicImpl "Round" static member Result : ('T -> 'T) = result type SignDynamicImplTable<'T>() = static let result : ('T -> int) = - let aty = typeof<'T> - if aty.Equals(typeof) then unboxPrim<_>(fun (x:float) -> signImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:float32) -> signImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:nativeint) -> signImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:decimal) -> signImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:int16) -> signImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:int32) -> signImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:int64) -> signImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:sbyte) -> signImpl x) + let ty = typeof<'T> + if Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float) -> signImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float32) -> signImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:nativeint) -> signImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:decimal) -> signImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:int16) -> signImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:int32) -> signImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:int64) -> signImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:sbyte) -> signImpl x) else UnaryDynamicImpl "Sign" static member Result : ('T -> int) = result type LogDynamicImplTable<'T>() = static let result : ('T -> 'T) = - let aty = typeof<'T> - if aty.Equals(typeof) then unboxPrim<_>(fun (x:float) -> logImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:float32) -> logImpl x) + let ty = typeof<'T> + if Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float) -> logImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float32) -> logImpl x) else UnaryDynamicImpl "Log" static member Result : ('T -> 'T) = result type Log10DynamicImplTable<'T>() = static let result : ('T -> 'T) = - let aty = typeof<'T> - if aty.Equals(typeof) then unboxPrim<_>(fun (x:float) -> log10Impl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:float32) -> log10Impl x) + let ty = typeof<'T> + if Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float) -> log10Impl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float32) -> log10Impl x) else UnaryDynamicImpl "Log10" static member Result : ('T -> 'T) = result type SqrtDynamicImplTable<'T,'U>() = static let result : ('T -> 'U) = - let aty = typeof<'T> - if aty.Equals(typeof) then unboxPrim<_>(fun (x:float) -> sqrtImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:float32) -> sqrtImpl x) + let ty = typeof<'T> + if Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float) -> sqrtImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float32) -> sqrtImpl x) else UnaryDynamicImpl "Sqrt" static member Result : ('T -> 'U) = result type CosDynamicImplTable<'T>() = static let result : ('T -> 'T) = - let aty = typeof<'T> - if aty.Equals(typeof) then unboxPrim<_>(fun (x:float) -> cosImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:float32) -> cosImpl x) + let ty = typeof<'T> + if Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float) -> cosImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float32) -> cosImpl x) else UnaryDynamicImpl "Cos" static member Result : ('T -> 'T) = result type CoshDynamicImplTable<'T>() = static let result : ('T -> 'T) = - let aty = typeof<'T> - if aty.Equals(typeof) then unboxPrim<_>(fun (x:float) -> coshImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:float32) -> coshImpl x) + let ty = typeof<'T> + if Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float) -> coshImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float32) -> coshImpl x) else UnaryDynamicImpl "Cosh" static member Result : ('T -> 'T) = result type SinDynamicImplTable<'T>() = static let result : ('T -> 'T) = - let aty = typeof<'T> - if aty.Equals(typeof) then unboxPrim<_>(fun (x:float) -> sinImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:float32) -> sinImpl x) + let ty = typeof<'T> + if Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float) -> sinImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float32) -> sinImpl x) else UnaryDynamicImpl "Sin" static member Result : ('T -> 'T) = result type SinhDynamicImplTable<'T>() = static let result : ('T -> 'T) = - let aty = typeof<'T> - if aty.Equals(typeof) then unboxPrim<_>(fun (x:float) -> sinhImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:float32) -> sinhImpl x) + let ty = typeof<'T> + if Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float) -> sinhImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float32) -> sinhImpl x) else UnaryDynamicImpl "Sinh" static member Result : ('T -> 'T) = result type TanDynamicImplTable<'T>() = static let result : ('T -> 'T) = - let aty = typeof<'T> - if aty.Equals(typeof) then unboxPrim<_>(fun (x:float) -> tanImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:float32) -> tanImpl x) + let ty = typeof<'T> + if Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float) -> tanImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float32) -> tanImpl x) else UnaryDynamicImpl "Tan" static member Result : ('T -> 'T) = result type TanhDynamicImplTable<'T>() = static let result : ('T -> 'T) = - let aty = typeof<'T> - if aty.Equals(typeof) then unboxPrim<_>(fun (x:float) -> tanhImpl x) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:float32) -> tanhImpl x) + let ty = typeof<'T> + if Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float) -> tanhImpl x) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float32) -> tanhImpl x) else UnaryDynamicImpl "Tanh" static member Result : ('T -> 'T) = result type PowDynamicImplTable<'T,'U>() = static let result : ('T -> 'U -> 'T) = - let aty = typeof<'T> - if aty.Equals(typeof) then unboxPrim<_>(fun (x:float) (y:float) -> powImpl x y) - elif aty.Equals(typeof) then unboxPrim<_>(fun (x:float32) (y:float32) -> powImpl x y) + let ty = typeof<'T> + if Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float) (y:float) -> powImpl x y) + elif Type.op_Equality(ty, typeof) then unboxPrim<_>(fun (x:float32) (y:float32) -> powImpl x y) else BinaryDynamicImpl "Pow" static member Result : ('T -> 'U -> 'T) = result diff --git a/src/FSharp.Core/quotations.fs b/src/FSharp.Core/quotations.fs index c3c7317e522..20f2e8ca06b 100644 --- a/src/FSharp.Core/quotations.fs +++ b/src/FSharp.Core/quotations.fs @@ -1403,7 +1403,7 @@ module Patterns = | Ambiguous of 'R let typeEquals (ty1: Type) (ty2: Type) = - ty1.Equals ty2 + Type.op_Equality (ty1, ty2) let typesEqual (tys1: Type list) (tys2: Type list) = (tys1.Length = tys2.Length) && List.forall2 typeEquals tys1 tys2 diff --git a/src/FSharp.Core/reflect.fs b/src/FSharp.Core/reflect.fs index 76dbb87c490..e9522f68c99 100644 --- a/src/FSharp.Core/reflect.fs +++ b/src/FSharp.Core/reflect.fs @@ -43,9 +43,9 @@ module internal Impl = isNamedType ty1 && if ty1.IsGenericType then ty2.IsGenericType - && (ty1.GetGenericTypeDefinition()).Equals(ty2.GetGenericTypeDefinition()) + && Type.op_Equality (ty1.GetGenericTypeDefinition(), ty2.GetGenericTypeDefinition()) else - ty1.Equals ty2 + Type.op_Equality (ty1, ty2) let func = typedefof<(obj -> obj)> diff --git a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs index 294cf2df55d..0740f5aa753 100644 --- a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs +++ b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs @@ -132,7 +132,7 @@ module FSharpDependencyManager = | Some "timeout", None -> raise (ArgumentException(SR.missingTimeoutValue ())) | Some "timeout", value -> match value with - | Some v when v.GetType() = typeof -> + | Some v when Type.op_Equality (v.GetType(), typeof) -> let parsed, value = Int32.TryParse(v) if parsed && value >= 0 then diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected b/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected index 9045f24ab29..d7f8a490d26 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected @@ -6744,10 +6744,10 @@ FSharp.Compiler.Syntax.SynExpr+TraitCall: FSharp.Compiler.Syntax.SynExpr argExpr FSharp.Compiler.Syntax.SynExpr+TraitCall: FSharp.Compiler.Syntax.SynExpr get_argExpr() FSharp.Compiler.Syntax.SynExpr+TraitCall: FSharp.Compiler.Syntax.SynMemberSig get_traitSig() FSharp.Compiler.Syntax.SynExpr+TraitCall: FSharp.Compiler.Syntax.SynMemberSig traitSig +FSharp.Compiler.Syntax.SynExpr+TraitCall: FSharp.Compiler.Syntax.SynType get_supportTys() +FSharp.Compiler.Syntax.SynExpr+TraitCall: FSharp.Compiler.Syntax.SynType supportTys FSharp.Compiler.Syntax.SynExpr+TraitCall: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynExpr+TraitCall: FSharp.Compiler.Text.Range range -FSharp.Compiler.Syntax.SynExpr+TraitCall: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType] get_supportTys() -FSharp.Compiler.Syntax.SynExpr+TraitCall: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType] supportTys FSharp.Compiler.Syntax.SynExpr+TryFinally: FSharp.Compiler.Syntax.DebugPointAtFinally finallyDebugPoint FSharp.Compiler.Syntax.SynExpr+TryFinally: FSharp.Compiler.Syntax.DebugPointAtFinally get_finallyDebugPoint() FSharp.Compiler.Syntax.SynExpr+TryFinally: FSharp.Compiler.Syntax.DebugPointAtTry get_tryDebugPoint() @@ -7030,7 +7030,7 @@ FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewRecord(Microso FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewSequential(FSharp.Compiler.Syntax.DebugPointAtSequential, Boolean, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewSequentialOrImplicitYield(FSharp.Compiler.Syntax.DebugPointAtSequential, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewSet(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) -FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewTraitCall(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType], FSharp.Compiler.Syntax.SynMemberSig, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewTraitCall(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynMemberSig, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewTryFinally(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.Syntax.DebugPointAtTry, FSharp.Compiler.Syntax.DebugPointAtFinally, FSharp.Compiler.SyntaxTrivia.SynExprTryFinallyTrivia) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewTryWith(FSharp.Compiler.Syntax.SynExpr, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynMatchClause], FSharp.Compiler.Text.Range, FSharp.Compiler.Syntax.DebugPointAtTry, FSharp.Compiler.Syntax.DebugPointAtWith, FSharp.Compiler.SyntaxTrivia.SynExprTryWithTrivia) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewTuple(Boolean, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynExpr], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Text.Range], FSharp.Compiler.Text.Range) @@ -8512,6 +8512,14 @@ FSharp.Compiler.Syntax.SynType+MeasurePower: FSharp.Compiler.Syntax.SynType base FSharp.Compiler.Syntax.SynType+MeasurePower: FSharp.Compiler.Syntax.SynType get_baseMeasure() FSharp.Compiler.Syntax.SynType+MeasurePower: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynType+MeasurePower: FSharp.Compiler.Text.Range range +FSharp.Compiler.Syntax.SynType+Or: FSharp.Compiler.Syntax.SynType get_lhsType() +FSharp.Compiler.Syntax.SynType+Or: FSharp.Compiler.Syntax.SynType get_rhsType() +FSharp.Compiler.Syntax.SynType+Or: FSharp.Compiler.Syntax.SynType lhsType +FSharp.Compiler.Syntax.SynType+Or: FSharp.Compiler.Syntax.SynType rhsType +FSharp.Compiler.Syntax.SynType+Or: FSharp.Compiler.SyntaxTrivia.SynTypeOrTrivia get_trivia() +FSharp.Compiler.Syntax.SynType+Or: FSharp.Compiler.SyntaxTrivia.SynTypeOrTrivia trivia +FSharp.Compiler.Syntax.SynType+Or: FSharp.Compiler.Text.Range get_range() +FSharp.Compiler.Syntax.SynType+Or: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynType+Paren: FSharp.Compiler.Syntax.SynType get_innerType() FSharp.Compiler.Syntax.SynType+Paren: FSharp.Compiler.Syntax.SynType innerType FSharp.Compiler.Syntax.SynType+Paren: FSharp.Compiler.Text.Range get_range() @@ -8550,6 +8558,7 @@ FSharp.Compiler.Syntax.SynType+Tags: Int32 LongIdent FSharp.Compiler.Syntax.SynType+Tags: Int32 LongIdentApp FSharp.Compiler.Syntax.SynType+Tags: Int32 MeasureDivide FSharp.Compiler.Syntax.SynType+Tags: Int32 MeasurePower +FSharp.Compiler.Syntax.SynType+Tags: Int32 Or FSharp.Compiler.Syntax.SynType+Tags: Int32 Paren FSharp.Compiler.Syntax.SynType+Tags: Int32 SignatureParameter FSharp.Compiler.Syntax.SynType+Tags: Int32 StaticConstant @@ -8584,6 +8593,7 @@ FSharp.Compiler.Syntax.SynType: Boolean IsLongIdent FSharp.Compiler.Syntax.SynType: Boolean IsLongIdentApp FSharp.Compiler.Syntax.SynType: Boolean IsMeasureDivide FSharp.Compiler.Syntax.SynType: Boolean IsMeasurePower +FSharp.Compiler.Syntax.SynType: Boolean IsOr FSharp.Compiler.Syntax.SynType: Boolean IsParen FSharp.Compiler.Syntax.SynType: Boolean IsSignatureParameter FSharp.Compiler.Syntax.SynType: Boolean IsStaticConstant @@ -8602,6 +8612,7 @@ FSharp.Compiler.Syntax.SynType: Boolean get_IsLongIdent() FSharp.Compiler.Syntax.SynType: Boolean get_IsLongIdentApp() FSharp.Compiler.Syntax.SynType: Boolean get_IsMeasureDivide() FSharp.Compiler.Syntax.SynType: Boolean get_IsMeasurePower() +FSharp.Compiler.Syntax.SynType: Boolean get_IsOr() FSharp.Compiler.Syntax.SynType: Boolean get_IsParen() FSharp.Compiler.Syntax.SynType: Boolean get_IsSignatureParameter() FSharp.Compiler.Syntax.SynType: Boolean get_IsStaticConstant() @@ -8620,6 +8631,7 @@ FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewLongIdent(FSha FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewLongIdentApp(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynLongIdent, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Text.Range], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewMeasureDivide(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewMeasurePower(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynRationalConst, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewOr(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynTypeOrTrivia) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewParen(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewSignatureParameter(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList], Boolean, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident], FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewStaticConstant(FSharp.Compiler.Syntax.SynConst, FSharp.Compiler.Text.Range) @@ -8638,6 +8650,7 @@ FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+LongIdent FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+LongIdentApp FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+MeasureDivide FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+MeasurePower +FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+Or FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+Paren FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+SignatureParameter FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+StaticConstant @@ -8715,10 +8728,10 @@ FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSubtypeOfType: FSharp.Compile FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSubtypeOfType: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSupportsMember: FSharp.Compiler.Syntax.SynMemberSig get_memberSig() FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSupportsMember: FSharp.Compiler.Syntax.SynMemberSig memberSig +FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSupportsMember: FSharp.Compiler.Syntax.SynType get_typars() +FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSupportsMember: FSharp.Compiler.Syntax.SynType typars FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSupportsMember: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSupportsMember: FSharp.Compiler.Text.Range range -FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSupportsMember: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType] get_typars() -FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSupportsMember: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType] typars FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSupportsNull: FSharp.Compiler.Syntax.SynTypar get_typar() FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSupportsNull: FSharp.Compiler.Syntax.SynTypar typar FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSupportsNull: FSharp.Compiler.Text.Range get_range() @@ -8757,7 +8770,7 @@ FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstrai FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparIsUnmanaged(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparIsValueType(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparSubtypeOfType(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range) -FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparSupportsMember(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType], FSharp.Compiler.Syntax.SynMemberSig, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparSupportsMember(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynMemberSig, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparSupportsNull(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint+Tags FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint+WhereSelfConstrained @@ -9594,6 +9607,11 @@ FSharp.Compiler.SyntaxTrivia.SynTypeFunTrivia: FSharp.Compiler.Text.Range ArrowR FSharp.Compiler.SyntaxTrivia.SynTypeFunTrivia: FSharp.Compiler.Text.Range get_ArrowRange() FSharp.Compiler.SyntaxTrivia.SynTypeFunTrivia: System.String ToString() FSharp.Compiler.SyntaxTrivia.SynTypeFunTrivia: Void .ctor(FSharp.Compiler.Text.Range) +FSharp.Compiler.SyntaxTrivia.SynTypeOrTrivia +FSharp.Compiler.SyntaxTrivia.SynTypeOrTrivia: FSharp.Compiler.Text.Range OrKeyword +FSharp.Compiler.SyntaxTrivia.SynTypeOrTrivia: FSharp.Compiler.Text.Range get_OrKeyword() +FSharp.Compiler.SyntaxTrivia.SynTypeOrTrivia: System.String ToString() +FSharp.Compiler.SyntaxTrivia.SynTypeOrTrivia: Void .ctor(FSharp.Compiler.Text.Range) FSharp.Compiler.SyntaxTrivia.SynUnionCaseTrivia FSharp.Compiler.SyntaxTrivia.SynUnionCaseTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] BarRange FSharp.Compiler.SyntaxTrivia.SynUnionCaseTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_BarRange() diff --git a/tests/service/SyntaxTreeTests/SynTypeTests.fs b/tests/service/SyntaxTreeTests/SynTypeTests.fs index 1ab5ed12e94..7f18521a995 100644 --- a/tests/service/SyntaxTreeTests/SynTypeTests.fs +++ b/tests/service/SyntaxTreeTests/SynTypeTests.fs @@ -49,3 +49,159 @@ type T = ])) -> assertRange (3, 14) (3, 56) mTuple | _ -> Assert.Fail $"Could not get valid AST, got {parseResults}" + +[] +let ``SynType.Or inside SynExpr.TraitCall`` () = + let parseResults = + getParseResults + """ +let inline (!!) (x: ^a) : ^b = ((^a or ^b): (static member op_Implicit: ^a -> ^b) x) + """ + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Let(bindings = [ + SynBinding(expr = + SynExpr.Typed(expr = + SynExpr.Paren(expr = + SynExpr.TraitCall(supportTys = + SynType.Paren( + SynType.Or( + SynType.Var(range = mVar1), + SynType.Var(range = mVar2), + mOrType, + { OrKeyword = mOrWord }), + mParen)) + ))) + ]) ]) ])) -> + assertRange (2, 33) (2, 35) mVar1 + assertRange (2, 36) (2, 38) mOrWord + assertRange (2, 39) (2, 41) mVar2 + assertRange (2, 33) (2, 41) mOrType + assertRange (2, 32) (2, 42) mParen + | _ -> Assert.Fail $"Could not get valid AST, got {parseResults}" + +[] +let ``SynType.Or inside SynTypeConstraint.WhereTyparSupportsMember`` () = + let parseResults = + getParseResults + """ +let inline f_StaticMethod<'T1, 'T2 when ('T1 or 'T2) : (static member StaticMethod: int -> int) >() : int = + () + """ + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Let(bindings = [ + SynBinding(headPat = + SynPat.LongIdent(typarDecls = Some (SynValTyparDecls(typars = Some (SynTyparDecls.PostfixList(constraints = [ + SynTypeConstraint.WhereTyparSupportsMember(typars = SynType.Paren( + SynType.Or( + SynType.Var(range = mVar1), + SynType.Var(range = mVar2), + mOrType, + { OrKeyword = mOrWord }), + mParen + )) + ])))))) + ]) ]) ])) -> + assertRange (2, 41) (2, 44) mVar1 + assertRange (2, 45) (2, 47) mOrWord + assertRange (2, 48) (2, 51) mVar2 + assertRange (2, 41) (2, 51) mOrType + assertRange (2, 40) (2, 52) mParen + | _ -> Assert.Fail $"Could not get valid AST, got {parseResults}" + +[] +let ``Nested SynType.Or inside SynExpr.TraitCall`` () = + let parseResults = + getParseResults + """ +let inline (!!) (x: ^a * ^b) : ^c = ((^a or ^b or ^c): (static member op_Implicit: ^a * ^b -> ^c) x) + """ + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Let(bindings = [ + SynBinding(expr = + SynExpr.Typed(expr = + SynExpr.Paren(expr = + SynExpr.TraitCall(supportTys = + SynType.Paren( + SynType.Or( + SynType.Or( + SynType.Var(range = mVarA), + SynType.Var(range = mVarB), + mOrType1, + { OrKeyword = mOrWord1 } + ), + SynType.Var(range = mVarC), + mOrType2, + { OrKeyword = mOrWord2 }), + mParen)) + ))) + ]) ]) ])) -> + assertRange (2, 38) (2, 40) mVarA + assertRange (2, 41) (2, 43) mOrWord1 + assertRange (2, 44) (2, 46) mVarB + assertRange (2, 38) (2, 46) mOrType1 + assertRange (2, 47) (2, 49) mOrWord2 + assertRange (2, 50) (2, 52) mVarC + assertRange (2, 38) (2, 52) mOrType2 + assertRange (2, 37) (2, 53) mParen + | _ -> Assert.Fail $"Could not get valid AST, got {parseResults}" + +[] +let ``Single SynType inside SynExpr.TraitCall`` () = + let parseResults = + getParseResults + """ +type X = + static member inline replace< ^a, ^b, ^c when ^b: (static member replace: ^a * ^b -> ^c)>(a: ^a, f: ^b) = + (^b : (static member replace: ^a * ^b -> ^c) (a, f)) + """ + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Types(typeDefns = [ + SynTypeDefn(typeRepr = SynTypeDefnRepr.ObjectModel(members = [ + SynMemberDefn.Member(memberDefn = + SynBinding(expr = + SynExpr.Paren(expr = + SynExpr.TraitCall(supportTys = + SynType.Var(range = mVar)) + ))) + ])) + ]) ]) ])) -> + assertRange (4, 9) (4, 11) mVar + | _ -> Assert.Fail $"Could not get valid AST, got {parseResults}" + +[] +let ``SynType.Or with appType on the right hand side`` () = + let parseResults = + getParseResults + """ +let inline f (x: 'T) = ((^T or int) : (static member A: int) ()) + """ + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Let(bindings = [ + SynBinding(expr = + SynExpr.Paren(expr = + SynExpr.TraitCall(supportTys = + SynType.Paren( + SynType.Or( + SynType.Var(range = mVar), + (SynType.LongIdent _ as appType), + mOrType, + { OrKeyword = mOrWord }), + mParen)) + )) + ]) ]) ])) -> + assertRange (2, 25) (2,27) mVar + assertRange (2, 28) (2, 30) mOrWord + assertRange (2, 31) (2, 34) appType.Range + assertRange (2,25) (2, 34) mOrType + assertRange (2,24) (2, 35) mParen + | _ -> Assert.Fail $"Could not get valid AST, got {parseResults}" diff --git a/tests/service/data/TestTP/ProvidedTypes.fs b/tests/service/data/TestTP/ProvidedTypes.fs index c13961cbc27..4e7a7604c6b 100644 --- a/tests/service/data/TestTP/ProvidedTypes.fs +++ b/tests/service/data/TestTP/ProvidedTypes.fs @@ -76,7 +76,7 @@ module Utils = /// General implementation of .Equals(Type) logic for System.Type over symbol types. You can use this with other types too. let rec eqTypes (ty1: Type) (ty2: Type) = if Object.ReferenceEquals(ty1, ty2) then true - elif ty1.IsGenericTypeDefinition then ty2.IsGenericTypeDefinition && ty1.Equals(ty2) + elif ty1.IsGenericTypeDefinition then ty2.IsGenericTypeDefinition && Type.op_Equality(ty1, ty2) elif ty1.IsGenericType then ty2.IsGenericType && not ty2.IsGenericTypeDefinition && eqTypes (ty1.GetGenericTypeDefinition()) (ty2.GetGenericTypeDefinition()) && lengthsEqAndForall2 (ty1.GetGenericArguments()) (ty2.GetGenericArguments()) eqTypes elif ty1.IsArray then ty2.IsArray && ty1.GetArrayRank() = ty2.GetArrayRank() && eqTypes (ty1.GetElementType()) (ty2.GetElementType()) elif ty1.IsPointer then ty2.IsPointer && eqTypes (ty1.GetElementType()) (ty2.GetElementType()) From 0b242512213c8297e2604a83dd1a65bd45d0cdfc Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Tue, 18 Oct 2022 01:41:54 -0700 Subject: [PATCH 44/51] Localized file check-in by OneLocBuild Task: Build definition ID 499: Build ID 2023680 (#14133) --- src/Compiler/xlf/FSStrings.cs.xlf | 2 +- src/Compiler/xlf/FSStrings.de.xlf | 2 +- src/Compiler/xlf/FSStrings.es.xlf | 2 +- src/Compiler/xlf/FSStrings.fr.xlf | 2 +- src/Compiler/xlf/FSStrings.it.xlf | 2 +- src/Compiler/xlf/FSStrings.ja.xlf | 2 +- src/Compiler/xlf/FSStrings.ko.xlf | 2 +- src/Compiler/xlf/FSStrings.pl.xlf | 2 +- src/Compiler/xlf/FSStrings.pt-BR.xlf | 2 +- src/Compiler/xlf/FSStrings.ru.xlf | 2 +- src/Compiler/xlf/FSStrings.tr.xlf | 2 +- src/Compiler/xlf/FSStrings.zh-Hans.xlf | 2 +- src/Compiler/xlf/FSStrings.zh-Hant.xlf | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Compiler/xlf/FSStrings.cs.xlf b/src/Compiler/xlf/FSStrings.cs.xlf index e525eea62e0..6ee3c64da5c 100644 --- a/src/Compiler/xlf/FSStrings.cs.xlf +++ b/src/Compiler/xlf/FSStrings.cs.xlf @@ -1559,7 +1559,7 @@ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case. - Implementace rozhraní v rozšířeních jsou už zastaralé. Implementace rozhraní by se měly provádět při počáteční deklaraci typu. + Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case. diff --git a/src/Compiler/xlf/FSStrings.de.xlf b/src/Compiler/xlf/FSStrings.de.xlf index 6643e012593..ec73de517aa 100644 --- a/src/Compiler/xlf/FSStrings.de.xlf +++ b/src/Compiler/xlf/FSStrings.de.xlf @@ -1559,7 +1559,7 @@ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case. - Schnittstellenimplementierungen in Augmentationen sind jetzt veraltet. Schnittstellenimplementierungen sollten in der ersten Deklaration eines Typs angegeben werden. + Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case. diff --git a/src/Compiler/xlf/FSStrings.es.xlf b/src/Compiler/xlf/FSStrings.es.xlf index a22c6cd20c4..e43bf987a24 100644 --- a/src/Compiler/xlf/FSStrings.es.xlf +++ b/src/Compiler/xlf/FSStrings.es.xlf @@ -1559,7 +1559,7 @@ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case. - Las implementaciones de interfaz en aumentos están en desuso. Las implementaciones de interfaz deben proporcionarse en la declaración inicial de un tipo. + Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case. diff --git a/src/Compiler/xlf/FSStrings.fr.xlf b/src/Compiler/xlf/FSStrings.fr.xlf index bbf8bdeb8a4..cd1f90f1ffe 100644 --- a/src/Compiler/xlf/FSStrings.fr.xlf +++ b/src/Compiler/xlf/FSStrings.fr.xlf @@ -1559,7 +1559,7 @@ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case. - Les implémentations d'interfaces dans les augmentations sont désormais déconseillées. Les implémentations d'interfaces doivent être fournies dans la déclaration initiale d'un type. + Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case. diff --git a/src/Compiler/xlf/FSStrings.it.xlf b/src/Compiler/xlf/FSStrings.it.xlf index 85f03305459..03f1c813477 100644 --- a/src/Compiler/xlf/FSStrings.it.xlf +++ b/src/Compiler/xlf/FSStrings.it.xlf @@ -1559,7 +1559,7 @@ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case. - Le implementazioni di interfaccia negli aumenti sono ora deprecate. Le implementazioni di interfaccia devono essere specificate nella dichiarazione iniziale di un tipo. + Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case. diff --git a/src/Compiler/xlf/FSStrings.ja.xlf b/src/Compiler/xlf/FSStrings.ja.xlf index d62c37b5fe7..b9148541515 100644 --- a/src/Compiler/xlf/FSStrings.ja.xlf +++ b/src/Compiler/xlf/FSStrings.ja.xlf @@ -1559,7 +1559,7 @@ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case. - 拡張内のインターフェイスの実装は使用されなくなりました。インターフェイスの実装は、型の最初の宣言で指定してください。 + Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case. diff --git a/src/Compiler/xlf/FSStrings.ko.xlf b/src/Compiler/xlf/FSStrings.ko.xlf index be73a0fc095..1de1b82a97e 100644 --- a/src/Compiler/xlf/FSStrings.ko.xlf +++ b/src/Compiler/xlf/FSStrings.ko.xlf @@ -1559,7 +1559,7 @@ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case. - 확대의 인터페이스 구현은 이제 사용되지 않습니다. 인터페이스 구현은 초기 형식 선언 시 지정해야 합니다. + Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case. diff --git a/src/Compiler/xlf/FSStrings.pl.xlf b/src/Compiler/xlf/FSStrings.pl.xlf index fcbe57f2d10..b545c38bf48 100644 --- a/src/Compiler/xlf/FSStrings.pl.xlf +++ b/src/Compiler/xlf/FSStrings.pl.xlf @@ -1559,7 +1559,7 @@ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case. - Implementacje interfejsów w powiększeniach są teraz przestarzałe. Implementacje interfejsów powinny występować w początkowej deklaracji typu. + Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case. diff --git a/src/Compiler/xlf/FSStrings.pt-BR.xlf b/src/Compiler/xlf/FSStrings.pt-BR.xlf index f9ebd64183c..bcd1400c2a7 100644 --- a/src/Compiler/xlf/FSStrings.pt-BR.xlf +++ b/src/Compiler/xlf/FSStrings.pt-BR.xlf @@ -1559,7 +1559,7 @@ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case. - Implementações de interface em aumentos agora são preteridas. Implementações de interface devem ser dadas nas declarações de tipo iniciais. + Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case. diff --git a/src/Compiler/xlf/FSStrings.ru.xlf b/src/Compiler/xlf/FSStrings.ru.xlf index 536e8d8aad6..dd59fd036a1 100644 --- a/src/Compiler/xlf/FSStrings.ru.xlf +++ b/src/Compiler/xlf/FSStrings.ru.xlf @@ -1559,7 +1559,7 @@ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case. - Реализации интерфейсов в приращениях теперь являются не рекомендуемыми к использованию. Реализации интерфейсов должны быть даны при первичном объявлении типа. + Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case. diff --git a/src/Compiler/xlf/FSStrings.tr.xlf b/src/Compiler/xlf/FSStrings.tr.xlf index 3a5cf3f06cc..9b787c168fe 100644 --- a/src/Compiler/xlf/FSStrings.tr.xlf +++ b/src/Compiler/xlf/FSStrings.tr.xlf @@ -1559,7 +1559,7 @@ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case. - Genişletmelerdeki arabirim uygulamaları artık kullanım dışı bırakıldı. Arabirim uygulamaları bir türün ilk bildiriminde verilmelidir. + Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case. diff --git a/src/Compiler/xlf/FSStrings.zh-Hans.xlf b/src/Compiler/xlf/FSStrings.zh-Hans.xlf index c7285c808b5..9fe0c865357 100644 --- a/src/Compiler/xlf/FSStrings.zh-Hans.xlf +++ b/src/Compiler/xlf/FSStrings.zh-Hans.xlf @@ -1559,7 +1559,7 @@ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case. - 扩大中的接口实现现已弃用。应在类型的初始声明中提供接口实现。 + Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case. diff --git a/src/Compiler/xlf/FSStrings.zh-Hant.xlf b/src/Compiler/xlf/FSStrings.zh-Hant.xlf index eb2c82827bc..d4c2e009b8d 100644 --- a/src/Compiler/xlf/FSStrings.zh-Hant.xlf +++ b/src/Compiler/xlf/FSStrings.zh-Hant.xlf @@ -1559,7 +1559,7 @@ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case. - 增強指定中的介面實作現在已被取代。應該在類型的初始宣告上指定介面實作。 + Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case. From 925e08ce1b49c1fc9eb153ae83ba6cedf033b5e1 Mon Sep 17 00:00:00 2001 From: Adam Boniecki <20281641+abonie@users.noreply.github.com> Date: Tue, 18 Oct 2022 16:42:39 +0200 Subject: [PATCH 45/51] Disable ref assemblies in e2e tests (#14135) Disable reference assemblies for e2e test of type providers Co-authored-by: Adam Boniecki Co-authored-by: Vlad Zarytovskii --- .../BasicProvider.DesignTime/BasicProvider.DesignTime.fsproj | 1 + .../BasicProvider/BasicProvider.Tests/BasicProvider.Tests.fsproj | 1 + .../BasicProvider/BasicProvider/BasicProvider.fsproj | 1 + 3 files changed, 3 insertions(+) diff --git a/tests/EndToEndBuildTests/BasicProvider/BasicProvider.DesignTime/BasicProvider.DesignTime.fsproj b/tests/EndToEndBuildTests/BasicProvider/BasicProvider.DesignTime/BasicProvider.DesignTime.fsproj index ab0d33bd429..95f3929fd81 100644 --- a/tests/EndToEndBuildTests/BasicProvider/BasicProvider.DesignTime/BasicProvider.DesignTime.fsproj +++ b/tests/EndToEndBuildTests/BasicProvider/BasicProvider.DesignTime/BasicProvider.DesignTime.fsproj @@ -7,6 +7,7 @@ NO_GENERATIVE IS_DESIGNTIME $(FSharpCoreShippedPackageVersionValue) + false diff --git a/tests/EndToEndBuildTests/BasicProvider/BasicProvider.Tests/BasicProvider.Tests.fsproj b/tests/EndToEndBuildTests/BasicProvider/BasicProvider.Tests/BasicProvider.Tests.fsproj index c157669ba0a..b90ea4de6f8 100644 --- a/tests/EndToEndBuildTests/BasicProvider/BasicProvider.Tests/BasicProvider.Tests.fsproj +++ b/tests/EndToEndBuildTests/BasicProvider/BasicProvider.Tests/BasicProvider.Tests.fsproj @@ -7,6 +7,7 @@ false NO_GENERATIVE $(FSharpCoreShippedPackageVersionValue) + false diff --git a/tests/EndToEndBuildTests/BasicProvider/BasicProvider/BasicProvider.fsproj b/tests/EndToEndBuildTests/BasicProvider/BasicProvider/BasicProvider.fsproj index 6dc26094835..6a00d20357c 100644 --- a/tests/EndToEndBuildTests/BasicProvider/BasicProvider/BasicProvider.fsproj +++ b/tests/EndToEndBuildTests/BasicProvider/BasicProvider/BasicProvider.fsproj @@ -7,6 +7,7 @@ $(FSharpCoreShippedPackageVersionValue) typeproviders $(NoWarn);NU5100;NU5118 + false From ee7a128b47eab8c6f99d5365da79d7ef26a67f30 Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Wed, 19 Oct 2022 00:17:03 -0700 Subject: [PATCH 46/51] Localized file check-in by OneLocBuild Task: Build definition ID 499: Build ID 2024009 (#14139) --- src/Compiler/xlf/FSComp.txt.cs.xlf | 2 +- src/Compiler/xlf/FSComp.txt.de.xlf | 2 +- src/Compiler/xlf/FSComp.txt.es.xlf | 2 +- src/Compiler/xlf/FSComp.txt.fr.xlf | 2 +- src/Compiler/xlf/FSComp.txt.it.xlf | 2 +- src/Compiler/xlf/FSComp.txt.ja.xlf | 2 +- src/Compiler/xlf/FSComp.txt.ko.xlf | 2 +- src/Compiler/xlf/FSComp.txt.pl.xlf | 2 +- src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 2 +- src/Compiler/xlf/FSComp.txt.ru.xlf | 2 +- src/Compiler/xlf/FSComp.txt.tr.xlf | 2 +- src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 2 +- src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index e595fe5fcdd..87880ae3911 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -7514,7 +7514,7 @@ If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'. - Pokud je typ sjednocení struktura a obsahuje více než jeden případ, všem polím v tomto typu sjednocení se musí přiřadit jedinečný název. + If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'. diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index 80707e0a21c..cbdc37bc29b 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -7514,7 +7514,7 @@ If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'. - Wenn ein Union-Typ mehrere case-Anweisungen aufweist und eine Struktur ist, müssen für alle Felder im Union-Typ eindeutige Namen angegeben werden. + If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'. diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index 5e43d0d1dff..38a8938e5d2 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -7514,7 +7514,7 @@ If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'. - Si un tipo de unión tiene más de un caso y un struct, a todos los campos dentro del tipo de unión se les deben dar nombres únicos. + If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'. diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index 7c3a34938fe..0d8124643fd 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -7514,7 +7514,7 @@ If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'. - Si un type union a plusieurs étiquettes case, et s'il s'agit d'un struct, tous les champs du type union doivent avoir des noms uniques. + If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'. diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 0e9fed9ce11..dcd916e5a54 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -7514,7 +7514,7 @@ If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'. - Se un tipo di unione contiene più di un case ed è una struttura, è necessario assegnare nomi univoci a tutti i campi all'interno del tipo di unione. + If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'. diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index a8ef7a18526..6e2afd8baba 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -7514,7 +7514,7 @@ If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'. - 共用体型が複数のケースを持つ 1 つの構造体である場合は、共用体型内のすべてのフィールドに一意の名前を付ける必要があります。 + If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'. diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index dd53a55a6a5..00af75d3785 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -7514,7 +7514,7 @@ If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'. - 공용 구조체 형식이 둘 이상의 case를 포함하고 구조체인 경우 공용 구조체 형식 내의 모든 필드에 고유한 이름을 지정해야 합니다. + If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'. diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index a9319b13341..c53ade01fad 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -7514,7 +7514,7 @@ If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'. - Jeśli typ unii ma więcej niż jeden przypadek i jest strukturą, wszystkim polom w typie unii należy nadać unikatowe nazwy. + If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'. diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 23dc53b6fb3..323505d44f6 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -7514,7 +7514,7 @@ If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'. - Se um tipo de união tiver mais de um caso e for struct, então todos os campos dentro do tipo de união deverão ter nomes exclusivos. + If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'. diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index 6fb3d75bd41..4db95952363 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -7514,7 +7514,7 @@ If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'. - Если тип объединения имеет более одного варианта и является структурой, всем полям в типе объединения необходимо присвоить уникальные имена. + If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'. diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index 185a0637d69..1ecdc134ac8 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -7514,7 +7514,7 @@ If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'. - Bir birleşim türü büyük ve küçük harfler içeriyorsa ve bir yapıysa, birleşim türü içindeki tüm alanlara benzersiz adlar verilmelidir. + If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index 7e8a3b175bc..f2d3b7f3906 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -7514,7 +7514,7 @@ If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'. - 如果联合类型有多个用例且为结构,则必须赋予此联合类型中的所有字段唯一的名称。 + If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index 702b93e2063..84f1d52014f 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -7514,7 +7514,7 @@ If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'. - 如果等位型別有一個以上的案例並且為結構,等位型別內所有欄位的名稱就都不得重複。 + If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'. From e707dc8b7a99f0f7c4dd0195709488464b557f77 Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Wed, 19 Oct 2022 14:49:55 +0200 Subject: [PATCH 47/51] Downgrade SDK, rc2 is failing signing (#14146) --- global.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/global.json b/global.json index c887182f54e..edbda82443f 100644 --- a/global.json +++ b/global.json @@ -1,11 +1,11 @@ { "sdk": { - "version": "7.0.100-rc.2.22477.23", + "version": "7.0.100-rc.1.22431.12", "allowPrerelease": true, "rollForward": "latestPatch" }, "tools": { - "dotnet": "7.0.100-rc.2.22477.23", + "dotnet": "7.0.100-rc.1.22431.12", "vs": { "version": "17.2", "components": [ From 90f5b1ed0befe8337b923860d29dcd62d4735aef Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Tue, 25 Oct 2022 02:58:00 -0700 Subject: [PATCH 48/51] Generate SBOM for Fsharp (#14029) (#14169) * Generate Sbom * pass ci flag * update * Sbom generation * Fix for trimming tests: Added nuget.org source + explicit source mapping for FSharp.Core * Update Build.ps1 Tweaks to handle useGlobalNugetCache Co-authored-by: Kevin Ransom (msft) Co-authored-by: Vlad Zarytovskii Co-authored-by: Kevin Ransom (msft) Co-authored-by: Epsitha Ananth <47157394+epananth@users.noreply.github.com> Co-authored-by: Kevin Ransom (msft) Co-authored-by: Vlad Zarytovskii Co-authored-by: Kevin Ransom (msft) --- Build.cmd | 2 +- azure-pipelines.yml | 2 ++ eng/Build.ps1 | 7 ++++++- eng/RestoreInternal.cmd | 2 ++ eng/restore-internal-tools.yml | 13 +++++++++++++ .../SelfContained_Trimming_Test/NuGet.Config | 11 ++++++++++- .../SelfContained_Trimming_Test.fsproj | 5 ++++- 7 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 eng/RestoreInternal.cmd create mode 100644 eng/restore-internal-tools.yml diff --git a/Build.cmd b/Build.cmd index ad55484933d..e8af08f3935 100644 --- a/Build.cmd +++ b/Build.cmd @@ -1,2 +1,2 @@ @echo off -powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\build.ps1""" -build -restore %*" +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\build.ps1""" -build -restore %*" \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e11a0e79377..a651322afe3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -118,6 +118,7 @@ stages: steps: - checkout: self clean: true + - template: /eng/restore-internal-tools.yml - script: eng\CIBuild.cmd -configuration $(_BuildConfig) -prepareMachine @@ -138,6 +139,7 @@ stages: /p:OfficialBuildId=$(BUILD.BUILDNUMBER) /p:PublishToSymbolServer=true /p:VisualStudioDropName=$(VisualStudioDropName) + /p:GenerateSbom=true - script: .\tests\EndToEndBuildTests\EndToEndBuildTests.cmd -c $(_BuildConfig) displayName: End to end build tests - task: PublishTestResults@2 diff --git a/eng/Build.ps1 b/eng/Build.ps1 index 8670b785994..c2d58455868 100644 --- a/eng/Build.ps1 +++ b/eng/Build.ps1 @@ -45,6 +45,7 @@ param ( [switch]$deployExtensions, [switch]$prepareMachine, [switch]$useGlobalNuGetCache = $true, + [switch]$dontUseGlobalNuGetCache = $false, [switch]$warnAsError = $true, [switch][Alias('test')]$testDesktop, [switch]$testCoreClr, @@ -113,7 +114,7 @@ function Print-Usage() { Write-Host " -msbuildEngine Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)." Write-Host " -procdump Monitor test runs with procdump" Write-Host " -prepareMachine Prepare machine for CI run, clean up processes after build" - Write-Host " -useGlobalNuGetCache Use global NuGet cache." + Write-Host " -dontUseGlobalNuGetCache Do not use the global NuGet cache" Write-Host " -noVisualStudio Only build fsc and fsi as .NET Core applications. No Visual Studio required. '-configuration', '-verbosity', '-norestore', '-rebuild' are supported." Write-Host " -sourceBuild Simulate building for source-build." Write-Host " -skipbuild Skip building product" @@ -131,6 +132,10 @@ function Process-Arguments() { exit 0 } + if ($dontUseGlobalNugetCache -or $ci) { + $script:useGlobalNugetCache = $False + } + $script:nodeReuse = $False; if ($testAll) { diff --git a/eng/RestoreInternal.cmd b/eng/RestoreInternal.cmd new file mode 100644 index 00000000000..cdd42f2c499 --- /dev/null +++ b/eng/RestoreInternal.cmd @@ -0,0 +1,2 @@ +@echo off +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0\common\build.ps1""" -build -restore %*" \ No newline at end of file diff --git a/eng/restore-internal-tools.yml b/eng/restore-internal-tools.yml new file mode 100644 index 00000000000..f71d0710e44 --- /dev/null +++ b/eng/restore-internal-tools.yml @@ -0,0 +1,13 @@ +steps: + - task: NuGetAuthenticate@0 + inputs: + nuGetServiceConnections: 'devdiv/dotnet-core-internal-tooling' + forceReinstallCredentialProvider: true + + - script: $(Build.SourcesDirectory)\eng\RestoreInternal.cmd + -ci + -projects $(Build.SourcesDirectory)/eng/common/internal/Tools.csproj + /bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/RestoreInternal.binlog + /v:normal + displayName: Restore internal tools + condition: and(succeeded(), ne(variables['_skipRestoreInternalTools'], 'true')) \ No newline at end of file diff --git a/tests/projects/SelfContained_Trimming_Test/NuGet.Config b/tests/projects/SelfContained_Trimming_Test/NuGet.Config index 277ccdc4067..e8af19a856b 100644 --- a/tests/projects/SelfContained_Trimming_Test/NuGet.Config +++ b/tests/projects/SelfContained_Trimming_Test/NuGet.Config @@ -1,11 +1,12 @@ - + + @@ -13,4 +14,12 @@ + + + + + + + + diff --git a/tests/projects/SelfContained_Trimming_Test/SelfContained_Trimming_Test.fsproj b/tests/projects/SelfContained_Trimming_Test/SelfContained_Trimming_Test.fsproj index b60d71ac565..6654cf18e18 100644 --- a/tests/projects/SelfContained_Trimming_Test/SelfContained_Trimming_Test.fsproj +++ b/tests/projects/SelfContained_Trimming_Test/SelfContained_Trimming_Test.fsproj @@ -10,6 +10,8 @@ true + true + true true win-x64 @@ -29,7 +31,8 @@ - $(MSBuildThisFileDirectory)/../../../artifacts/packages/Release/Release + $(MSBuildThisFileDirectory)/../../../artifacts/packages/Release/Release; + https://api.nuget.org/v3/index.json; From 04c3620c2cac2f4ce3d41638c134671670c9325c Mon Sep 17 00:00:00 2001 From: Matt Galbraith Date: Thu, 27 Oct 2022 04:54:02 -0700 Subject: [PATCH 49/51] Update Arcade & Put automated pool provider usage functionality into Dev17.4 branch (similar to PR in main now but will not be backported here) (#14177) --- azure-pipelines.yml | 20 ++++---- eng/Version.Details.xml | 8 +-- eng/Versions.props | 2 - eng/common/cross/arm/tizen-fetch.sh | 6 +-- eng/common/cross/arm64/tizen-fetch.sh | 8 +-- eng/common/cross/armel/tizen-fetch.sh | 8 +-- eng/common/cross/armel/tizen/tizen-dotnet.ks | 50 ------------------- eng/common/cross/build-android-rootfs.sh | 4 +- eng/common/cross/build-rootfs.sh | 7 +-- eng/common/cross/x86/tizen-fetch.sh | 6 +-- eng/common/init-tools-native.ps1 | 1 + eng/common/templates/job/execute-sdl.yml | 5 +- eng/common/templates/job/job.yml | 4 ++ eng/common/templates/job/onelocbuild.yml | 29 +++++------ .../templates/job/publish-build-assets.yml | 13 ++++- eng/common/templates/job/source-build.yml | 15 +++++- .../templates/job/source-index-stage1.yml | 5 +- eng/common/templates/jobs/jobs.yml | 9 ---- eng/common/templates/jobs/source-build.yml | 2 +- .../templates/post-build/post-build.yml | 14 +++--- eng/common/templates/steps/generate-sbom.yml | 4 ++ eng/common/templates/steps/source-build.yml | 6 +++ .../templates/variables/pool-providers.yml | 48 ++++++++++++++++++ eng/common/tools.sh | 22 +++++--- global.json | 4 +- 25 files changed, 170 insertions(+), 130 deletions(-) delete mode 100644 eng/common/cross/armel/tizen/tizen-dotnet.ks create mode 100644 eng/common/templates/variables/pool-providers.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2b2fcca507c..1f53eb633ed 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -68,6 +68,8 @@ variables: - ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}: - name: RunningAsPullRequest value: true + # Pick up pool provider name behavior from shared yaml template + - template: /eng/common/templates/variables/pool-providers.yml # Variables defined in yml cannot be overridden at queue time; instead overridable variables must be defined in the web UI. # Commenting out until something like this is supported: https://github.com/Microsoft/azure-pipelines-yaml/pull/129 @@ -104,7 +106,7 @@ stages: jobs: - job: Full_Signed pool: - name: NetCore1ESPool-Svc-Internal + name: $(DncEngInternalBuildPool) demands: ImageOverride -equals windows.vs2022.amd64 timeoutInMinutes: 300 variables: @@ -210,7 +212,7 @@ stages: - name: _SignType value: Test pool: - name: NetCore-Public + name: $(DncEngPublicBuildPool) demands: ImageOverride -equals $(WindowsMachineQueueName) timeoutInMinutes: 90 steps: @@ -283,7 +285,7 @@ stages: # WindowsMachineQueueName=Windows.vs2022.amd64.open # and there is an alternate build definition that sets this to a queue that is always scouting the # next preview of Visual Studio. - name: NetCore-Public + name: $(DncEngPublicBuildPool) demands: ImageOverride -equals $(WindowsMachineQueueName) timeoutInMinutes: 120 strategy: @@ -341,7 +343,7 @@ stages: # WindowsMachineQueueName=Windows.vs2022.amd64.open # and there is an alternate build definition that sets this to a queue that is always scouting the # next preview of Visual Studio. - name: NetCore-Public + name: $(DncEngPublicBuildPool) demands: ImageOverride -equals $(WindowsMachineQueueName) timeoutInMinutes: 120 strategy: @@ -395,7 +397,7 @@ stages: # Mock official build - job: MockOfficial pool: - name: NetCore-Public + name: $(DncEngPublicBuildPool) demands: ImageOverride -equals $(WindowsMachineQueueName) steps: - checkout: self @@ -486,7 +488,7 @@ stages: # End to end build - job: EndToEndBuildTests pool: - name: NetCore-Public + name: $(DncEngPublicBuildPool) demands: ImageOverride -equals $(WindowsMachineQueueName) steps: - checkout: self @@ -515,7 +517,7 @@ stages: - name: _SignType value: Test pool: - name: NetCore-Public + name: $(DncEngPublicBuildPool) demands: ImageOverride -equals $(WindowsMachineQueueName) timeoutInMinutes: 90 steps: @@ -541,7 +543,7 @@ stages: # Plain build Windows - job: Plain_Build_Windows pool: - name: NetCore-Public + name: $(DncEngPublicBuildPool) demands: ImageOverride -equals $(WindowsMachineQueueName) variables: - name: _BuildConfig @@ -638,7 +640,7 @@ stages: # Test trimming on Windows - job: Build_And_Test_Trimming_Windows pool: - name: NetCore-Public + name: $(DncEngPublicBuildPool) demands: ImageOverride -equals $(WindowsMachineQueueName) strategy: maxParallel: 2 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 80e7ef74b8e..4dbba158d78 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -8,14 +8,14 @@ - + https://github.com/dotnet/arcade - ba4d2568dd2e3e7538feeaba60215f7bcb99e89c + c5dd6a1da2e6d9b3423ab809fcda8af2927a408b - + https://github.com/dotnet/arcade - ba4d2568dd2e3e7538feeaba60215f7bcb99e89c + c5dd6a1da2e6d9b3423ab809fcda8af2927a408b diff --git a/eng/Versions.props b/eng/Versions.props index 4c5fb4a0a85..bcaecdd34a7 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -56,9 +56,7 @@ 17 - 4 - $(VSMajorVersion).0 $(VSMajorVersion).$(VSMinorVersion).0 $(VSAssemblyVersionPrefix).0 diff --git a/eng/common/cross/arm/tizen-fetch.sh b/eng/common/cross/arm/tizen-fetch.sh index eabd06c4afe..0adb0f11ec3 100644 --- a/eng/common/cross/arm/tizen-fetch.sh +++ b/eng/common/cross/arm/tizen-fetch.sh @@ -51,7 +51,7 @@ if [ ! -d $TMPDIR ]; then mkdir -p $TMPDIR fi -TIZEN_URL=http://download.tizen.org/snapshots/tizen +TIZEN_URL=http://download.tizen.org/snapshots/TIZEN/Tizen BUILD_XML=build.xml REPOMD_XML=repomd.xml PRIMARY_XML=primary.xml @@ -155,7 +155,7 @@ fetch_tizen_pkgs() } Inform "Initialize arm base" -fetch_tizen_pkgs_init standard base +fetch_tizen_pkgs_init standard Tizen-Base Inform "fetch common packages" fetch_tizen_pkgs armv7hl gcc gcc-devel-static glibc glibc-devel libicu libicu-devel libatomic linux-glibc-devel keyutils keyutils-devel libkeyutils Inform "fetch coreclr packages" @@ -164,7 +164,7 @@ Inform "fetch corefx packages" fetch_tizen_pkgs armv7hl libcom_err libcom_err-devel zlib zlib-devel libopenssl11 libopenssl1.1-devel krb5 krb5-devel Inform "Initialize standard unified" -fetch_tizen_pkgs_init standard unified +fetch_tizen_pkgs_init standard Tizen-Unified Inform "fetch corefx packages" fetch_tizen_pkgs armv7hl gssdp gssdp-devel tizen-release diff --git a/eng/common/cross/arm64/tizen-fetch.sh b/eng/common/cross/arm64/tizen-fetch.sh index 16d1301f21e..785bd85484e 100644 --- a/eng/common/cross/arm64/tizen-fetch.sh +++ b/eng/common/cross/arm64/tizen-fetch.sh @@ -51,7 +51,7 @@ if [ ! -d $TMPDIR ]; then mkdir -p $TMPDIR fi -TIZEN_URL=http://download.tizen.org/snapshots/tizen/ +TIZEN_URL=http://download.tizen.org/snapshots/TIZEN/Tizen BUILD_XML=build.xml REPOMD_XML=repomd.xml PRIMARY_XML=primary.xml @@ -154,8 +154,8 @@ fetch_tizen_pkgs() done } -Inform "Initialize arm base" -fetch_tizen_pkgs_init standard base +Inform "Initialize arm64 base" +fetch_tizen_pkgs_init standard Tizen-Base Inform "fetch common packages" fetch_tizen_pkgs aarch64 gcc glibc glibc-devel libicu libicu-devel libatomic linux-glibc-devel keyutils keyutils-devel libkeyutils Inform "fetch coreclr packages" @@ -164,7 +164,7 @@ Inform "fetch corefx packages" fetch_tizen_pkgs aarch64 libcom_err libcom_err-devel zlib zlib-devel libopenssl11 libopenssl1.1-devel krb5 krb5-devel Inform "Initialize standard unified" -fetch_tizen_pkgs_init standard unified +fetch_tizen_pkgs_init standard Tizen-Unified Inform "fetch corefx packages" fetch_tizen_pkgs aarch64 gssdp gssdp-devel tizen-release diff --git a/eng/common/cross/armel/tizen-fetch.sh b/eng/common/cross/armel/tizen-fetch.sh index 64f0187e5aa..3d8f177a344 100755 --- a/eng/common/cross/armel/tizen-fetch.sh +++ b/eng/common/cross/armel/tizen-fetch.sh @@ -51,7 +51,7 @@ if [ ! -d $TMPDIR ]; then mkdir -p $TMPDIR fi -TIZEN_URL=http://download.tizen.org/snapshots/tizen +TIZEN_URL=http://download.tizen.org/snapshots/TIZEN/Tizen BUILD_XML=build.xml REPOMD_XML=repomd.xml PRIMARY_XML=primary.xml @@ -154,8 +154,8 @@ fetch_tizen_pkgs() done } -Inform "Initialize arm base" -fetch_tizen_pkgs_init standard base +Inform "Initialize armel base" +fetch_tizen_pkgs_init standard Tizen-Base Inform "fetch common packages" fetch_tizen_pkgs armv7l gcc gcc-devel-static glibc glibc-devel libicu libicu-devel libatomic linux-glibc-devel keyutils keyutils-devel libkeyutils Inform "fetch coreclr packages" @@ -164,7 +164,7 @@ Inform "fetch corefx packages" fetch_tizen_pkgs armv7l libcom_err libcom_err-devel zlib zlib-devel libopenssl11 libopenssl1.1-devel krb5 krb5-devel Inform "Initialize standard unified" -fetch_tizen_pkgs_init standard unified +fetch_tizen_pkgs_init standard Tizen-Unified Inform "fetch corefx packages" fetch_tizen_pkgs armv7l gssdp gssdp-devel tizen-release diff --git a/eng/common/cross/armel/tizen/tizen-dotnet.ks b/eng/common/cross/armel/tizen/tizen-dotnet.ks deleted file mode 100644 index 506d455bd4f..00000000000 --- a/eng/common/cross/armel/tizen/tizen-dotnet.ks +++ /dev/null @@ -1,50 +0,0 @@ -lang en_US.UTF-8 -keyboard us -timezone --utc Asia/Seoul - -part / --fstype="ext4" --size=3500 --ondisk=mmcblk0 --label rootfs --fsoptions=defaults,noatime - -rootpw tizen -desktop --autologinuser=root -user --name root --groups audio,video --password 'tizen' - -repo --name=standard --baseurl=http://download.tizen.org/releases/milestone/tizen/unified/latest/repos/standard/packages/ --ssl_verify=no -repo --name=base --baseurl=http://download.tizen.org/releases/milestone/tizen/base/latest/repos/standard/packages/ --ssl_verify=no - -%packages -tar -gzip - -sed -grep -gawk -perl - -binutils -findutils -util-linux -lttng-ust -userspace-rcu -procps-ng -tzdata -ca-certificates - - -### Core FX -libicu -libunwind -iputils -zlib -krb5 -libcurl -libopenssl - -%end - -%post - -### Update /tmp privilege -chmod 777 /tmp -#################################### - -%end diff --git a/eng/common/cross/build-android-rootfs.sh b/eng/common/cross/build-android-rootfs.sh index 42516bbeebc..f163fb9dae9 100755 --- a/eng/common/cross/build-android-rootfs.sh +++ b/eng/common/cross/build-android-rootfs.sh @@ -107,12 +107,12 @@ __AndroidPackages+=" liblzma" __AndroidPackages+=" krb5" __AndroidPackages+=" openssl" -for path in $(wget -qO- http://termux.net/dists/stable/main/binary-$__AndroidArch/Packages |\ +for path in $(wget -qO- https://packages.termux.dev/termux-main-21/dists/stable/main/binary-$__AndroidArch/Packages |\ grep -A15 "Package: \(${__AndroidPackages// /\\|}\)" | grep -v "static\|tool" | grep Filename); do if [[ "$path" != "Filename:" ]]; then echo "Working on: $path" - wget -qO- http://termux.net/$path | dpkg -x - "$__TmpDir" + wget -qO- https://packages.termux.dev/termux-main-21/$path | dpkg -x - "$__TmpDir" fi done diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index 5680980fa29..eddb4c380af 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -391,9 +391,9 @@ elif [[ "$__CodeName" == "illumos" ]]; then --with-gnu-ld --disable-nls --disable-libgomp --disable-libquadmath --disable-libssp --disable-libvtv --disable-libcilkrts --disable-libada --disable-libsanitizer \ --disable-libquadmath-support --disable-shared --enable-tls make -j "$JOBS" && make install && cd .. - BaseUrl=https://pkgsrc.joyent.com + BaseUrl=https://pkgsrc.smartos.org if [[ "$__UseMirror" == 1 ]]; then - BaseUrl=http://pkgsrc.smartos.skylime.net + BaseUrl=https://pkgsrc.smartos.skylime.net fi BaseUrl="$BaseUrl/packages/SmartOS/trunk/${__illumosArch}/All" echo "Downloading manifest" @@ -402,7 +402,8 @@ elif [[ "$__CodeName" == "illumos" ]]; then read -ra array <<<"$__IllumosPackages" for package in "${array[@]}"; do echo "Installing '$package'" - package="$(grep ">$package-[0-9]" All | sed -En 's/.*href="(.*)\.tgz".*/\1/p')" + # find last occurrence of package in listing and extract its name + package="$(sed -En '/.*href="('"$package"'-[0-9].*).tgz".*/h;$!d;g;s//\1/p' All)" echo "Resolved name '$package'" wget "$BaseUrl"/"$package".tgz ar -x "$package".tgz diff --git a/eng/common/cross/x86/tizen-fetch.sh b/eng/common/cross/x86/tizen-fetch.sh index fa5f88b7d6c..cf8d1ce4a8e 100644 --- a/eng/common/cross/x86/tizen-fetch.sh +++ b/eng/common/cross/x86/tizen-fetch.sh @@ -51,7 +51,7 @@ if [ ! -d $TMPDIR ]; then mkdir -p $TMPDIR fi -TIZEN_URL=http://download.tizen.org/snapshots/tizen +TIZEN_URL=http://download.tizen.org/snapshots/TIZEN/Tizen BUILD_XML=build.xml REPOMD_XML=repomd.xml PRIMARY_XML=primary.xml @@ -155,7 +155,7 @@ fetch_tizen_pkgs() } Inform "Initialize i686 base" -fetch_tizen_pkgs_init standard base +fetch_tizen_pkgs_init standard Tizen-Base Inform "fetch common packages" fetch_tizen_pkgs i686 gcc gcc-devel-static glibc glibc-devel libicu libicu-devel libatomic linux-glibc-devel keyutils keyutils-devel libkeyutils Inform "fetch coreclr packages" @@ -164,7 +164,7 @@ Inform "fetch corefx packages" fetch_tizen_pkgs i686 libcom_err libcom_err-devel zlib zlib-devel libopenssl11 libopenssl1.1-devel krb5 krb5-devel Inform "Initialize standard unified" -fetch_tizen_pkgs_init standard unified +fetch_tizen_pkgs_init standard Tizen-Unified Inform "fetch corefx packages" fetch_tizen_pkgs i686 gssdp gssdp-devel tizen-release diff --git a/eng/common/init-tools-native.ps1 b/eng/common/init-tools-native.ps1 index ac42f04a9d8..fbc67effc36 100644 --- a/eng/common/init-tools-native.ps1 +++ b/eng/common/init-tools-native.ps1 @@ -113,6 +113,7 @@ try { $ToolPath = Convert-Path -Path $BinPath Write-Host "Adding $ToolName to the path ($ToolPath)..." Write-Host "##vso[task.prependpath]$ToolPath" + $env:PATH = "$ToolPath;$env:PATH" $InstalledTools += @{ $ToolName = $ToolDirectory.FullName } } } diff --git a/eng/common/templates/job/execute-sdl.yml b/eng/common/templates/job/execute-sdl.yml index 781a41c9404..7aabaa18017 100644 --- a/eng/common/templates/job/execute-sdl.yml +++ b/eng/common/templates/job/execute-sdl.yml @@ -34,7 +34,7 @@ jobs: - job: Run_SDL dependsOn: ${{ parameters.dependsOn }} displayName: Run SDL tool - condition: eq( ${{ parameters.enable }}, 'true') + condition: and(succeededOrFailed(), eq( ${{ parameters.enable }}, 'true')) variables: - group: DotNet-VSTS-Bot - name: AzDOProjectName @@ -46,6 +46,7 @@ jobs: - template: /eng/common/templates/variables/sdl-variables.yml - name: GuardianVersion value: ${{ coalesce(parameters.overrideGuardianVersion, '$(DefaultGuardianVersion)') }} + - template: /eng/common/templates/variables/pool-providers.yml pool: # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: @@ -53,7 +54,7 @@ jobs: demands: Cmd # If it's not devdiv, it's dnceng ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: - name: NetCore1ESPool-Internal + name: $(DncEngInternalBuildPool) demands: ImageOverride -equals windows.vs2019.amd64 steps: - checkout: self diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index 459f3c4fcbb..9f55d3f4666 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -25,6 +25,7 @@ parameters: enablePublishTestResults: false enablePublishUsingPipelines: false disableComponentGovernance: false + componentGovernanceIgnoreDirectories: '' mergeTestResults: false testRunTitle: '' testResultsFormat: '' @@ -146,6 +147,8 @@ jobs: - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), ne(parameters.disableComponentGovernance, 'true')) }}: - task: ComponentGovernanceComponentDetection@0 continueOnError: true + inputs: + ignoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} - ${{ if eq(parameters.enableMicrobuild, 'true') }}: - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: @@ -223,4 +226,5 @@ jobs: parameters: PackageVersion: ${{ parameters.packageVersion}} BuildDropPath: ${{ parameters.buildDropPath }} + IgnoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} diff --git a/eng/common/templates/job/onelocbuild.yml b/eng/common/templates/job/onelocbuild.yml index 6c523b714f4..c2cabcf9e06 100644 --- a/eng/common/templates/job/onelocbuild.yml +++ b/eng/common/templates/job/onelocbuild.yml @@ -22,13 +22,25 @@ parameters: MirrorRepo: '' MirrorBranch: main condition: '' + JobNameSuffix: '' jobs: -- job: OneLocBuild +- job: OneLocBuild${{ parameters.JobNameSuffix }} dependsOn: ${{ parameters.dependsOn }} - displayName: OneLocBuild + displayName: OneLocBuild${{ parameters.JobNameSuffix }} + + variables: + - group: OneLocBuildVariables # Contains the CeapexPat and GithubPat + - name: _GenerateLocProjectArguments + value: -SourcesDirectory ${{ parameters.SourcesDirectory }} + -LanguageSet "${{ parameters.LanguageSet }}" + -CreateNeutralXlfs + - ${{ if eq(parameters.UseCheckedInLocProjectJson, 'true') }}: + - name: _GenerateLocProjectArguments + value: ${{ variables._GenerateLocProjectArguments }} -UseCheckedInLocProjectJson + - template: /eng/common/templates/variables/pool-providers.yml ${{ if ne(parameters.pool, '') }}: pool: ${{ parameters.pool }} @@ -40,20 +52,9 @@ jobs: demands: Cmd # If it's not devdiv, it's dnceng ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: - name: NetCore1ESPool-Internal + name: $(DncEngInternalBuildPool) demands: ImageOverride -equals windows.vs2019.amd64 - variables: - - group: OneLocBuildVariables # Contains the CeapexPat and GithubPat - - name: _GenerateLocProjectArguments - value: -SourcesDirectory ${{ parameters.SourcesDirectory }} - -LanguageSet "${{ parameters.LanguageSet }}" - -CreateNeutralXlfs - - ${{ if eq(parameters.UseCheckedInLocProjectJson, 'true') }}: - - name: _GenerateLocProjectArguments - value: ${{ variables._GenerateLocProjectArguments }} -UseCheckedInLocProjectJson - - steps: - task: Powershell@2 inputs: diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml index 1cbb6a0c560..1f1b78f2d45 100644 --- a/eng/common/templates/job/publish-build-assets.yml +++ b/eng/common/templates/job/publish-build-assets.yml @@ -40,9 +40,8 @@ jobs: ${{ else }}: displayName: Publish to Build Asset Registry - pool: ${{ parameters.pool }} - variables: + - template: /eng/common/templates/variables/pool-providers.yml - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - group: Publish-Build-Assets - group: AzureDevOps-Artifact-Feeds-Pats @@ -51,6 +50,16 @@ jobs: - ${{ if eq(parameters.publishAssetsImmediately, 'true') }}: - template: /eng/common/templates/post-build/common-variables.yml + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: VSEngSS-MicroBuild2022-1ES + demands: Cmd + # If it's not devdiv, it's dnceng + ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: + name: $(DncEngInternalBuildPool) + demands: ImageOverride -equals windows.vs2019.amd64 + steps: - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - task: DownloadBuildArtifacts@0 diff --git a/eng/common/templates/job/source-build.yml b/eng/common/templates/job/source-build.yml index 88f6f75a622..e40bf35203b 100644 --- a/eng/common/templates/job/source-build.yml +++ b/eng/common/templates/job/source-build.yml @@ -44,13 +44,24 @@ jobs: ${{ if eq(parameters.platform.pool, '') }}: # The default VM host AzDO pool. This should be capable of running Docker containers: almost all # source-build builds run in Docker, including the default managed platform. + # /eng/common/templates/variables/pool-providers.yml can't be used here (some customers declare variables already), so duplicate its logic pool: - ${{ if eq(variables['System.TeamProject'], 'public') }}: + # Main environments + ${{ if and(eq(variables['System.TeamProject'], 'public'), ne(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), true)) }}: name: NetCore-Public demands: ImageOverride -equals Build.Ubuntu.1804.Amd64.Open - ${{ if eq(variables['System.TeamProject'], 'internal') }}: + ${{ if and(eq(variables['System.TeamProject'], 'internal'), ne(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), true)) }}: name: NetCore1ESPool-Internal demands: ImageOverride -equals Build.Ubuntu.1804.Amd64 + + # Servicing build environments + ${{ if and(eq(variables['System.TeamProject'], 'public'), contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release')) }}: + name: NetCore-Svc-Public + demands: ImageOverride -equals Build.Ubuntu.1804.Amd64.Open + ${{ if and(eq(variables['System.TeamProject'], 'internal'), contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release')) }}: + name: NetCore1ESPool-Svc-Internal + demands: ImageOverride -equals Build.Ubuntu.1804.Amd64 + ${{ if ne(parameters.platform.pool, '') }}: pool: ${{ parameters.platform.pool }} diff --git a/eng/common/templates/job/source-index-stage1.yml b/eng/common/templates/job/source-index-stage1.yml index 21fd12276b6..09c506d1185 100644 --- a/eng/common/templates/job/source-index-stage1.yml +++ b/eng/common/templates/job/source-index-stage1.yml @@ -22,16 +22,17 @@ jobs: value: ${{ parameters.binlogPath }} - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - group: source-dot-net stage1 variables + - template: /eng/common/templates/variables/pool-providers.yml ${{ if ne(parameters.pool, '') }}: pool: ${{ parameters.pool }} ${{ if eq(parameters.pool, '') }}: pool: ${{ if eq(variables['System.TeamProject'], 'public') }}: - name: NetCore-Public + name: $(DncEngPublicBuildPool) demands: ImageOverride -equals windows.vs2019.amd64.open ${{ if eq(variables['System.TeamProject'], 'internal') }}: - name: NetCore1ESPool-Internal + name: $(DncEngInternalBuildPool) demands: ImageOverride -equals windows.vs2019.amd64 steps: diff --git a/eng/common/templates/jobs/jobs.yml b/eng/common/templates/jobs/jobs.yml index 64e5929f221..289bb2396ce 100644 --- a/eng/common/templates/jobs/jobs.yml +++ b/eng/common/templates/jobs/jobs.yml @@ -88,15 +88,6 @@ jobs: - ${{ job.job }} - ${{ if eq(parameters.enableSourceBuild, true) }}: - Source_Build_Complete - pool: - # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) - ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: - name: VSEngSS-MicroBuild2022-1ES - demands: Cmd - # If it's not devdiv, it's dnceng - ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: - name: NetCore1ESPool-Internal - demands: ImageOverride -equals windows.vs2019.amd64 runAsPublic: ${{ parameters.runAsPublic }} publishUsingPipelines: ${{ parameters.enablePublishUsingPipelines }} diff --git a/eng/common/templates/jobs/source-build.yml b/eng/common/templates/jobs/source-build.yml index 8dd2d355f22..a15b07eb51d 100644 --- a/eng/common/templates/jobs/source-build.yml +++ b/eng/common/templates/jobs/source-build.yml @@ -14,7 +14,7 @@ parameters: # This is the default platform provided by Arcade, intended for use by a managed-only repo. defaultManagedPlatform: name: 'Managed' - container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8-20220809204800-17a4aab' + container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8' # Defines the platforms on which to run build jobs. One job is created for each platform, and the # object in this array is sent to the job template as 'platform'. If no platforms are specified, diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 87fcae940cf..91251d08973 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -95,10 +95,11 @@ stages: displayName: Validate Build Assets variables: - template: common-variables.yml + - template: /eng/common/templates/variables/pool-providers.yml jobs: - job: displayName: NuGet Validation - condition: eq( ${{ parameters.enableNugetValidation }}, 'true') + condition: and(succeededOrFailed(), eq( ${{ parameters.enableNugetValidation }}, 'true')) pool: # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: @@ -106,7 +107,7 @@ stages: demands: Cmd # If it's not devdiv, it's dnceng ${{ else }}: - name: NetCore1ESPool-Internal + name: $(DncEngInternalBuildPool) demands: ImageOverride -equals windows.vs2019.amd64 steps: @@ -143,7 +144,7 @@ stages: demands: Cmd # If it's not devdiv, it's dnceng ${{ else }}: - name: NetCore1ESPool-Internal + name: $(DncEngInternalBuildPool) demands: ImageOverride -equals windows.vs2019.amd64 steps: - template: setup-maestro-vars.yml @@ -203,7 +204,7 @@ stages: demands: Cmd # If it's not devdiv, it's dnceng ${{ else }}: - name: NetCore1ESPool-Internal + name: $(DncEngInternalBuildPool) demands: ImageOverride -equals windows.vs2019.amd64 steps: - template: setup-maestro-vars.yml @@ -251,6 +252,7 @@ stages: displayName: Publish using Darc variables: - template: common-variables.yml + - template: /eng/common/templates/variables/pool-providers.yml jobs: - job: displayName: Publish Using Darc @@ -262,7 +264,7 @@ stages: demands: Cmd # If it's not devdiv, it's dnceng ${{ else }}: - name: NetCore1ESPool-Internal + name: $(DncEngInternalBuildPool) demands: ImageOverride -equals windows.vs2019.amd64 steps: - template: setup-maestro-vars.yml @@ -282,4 +284,4 @@ stages: -MaestroToken '$(MaestroApiAccessToken)' -WaitPublishingFinish true -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' - -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' \ No newline at end of file + -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' diff --git a/eng/common/templates/steps/generate-sbom.yml b/eng/common/templates/steps/generate-sbom.yml index 4cea8c33187..a06373f38fa 100644 --- a/eng/common/templates/steps/generate-sbom.yml +++ b/eng/common/templates/steps/generate-sbom.yml @@ -2,12 +2,14 @@ # PackageName - The name of the package this SBOM represents. # PackageVersion - The version of the package this SBOM represents. # ManifestDirPath - The path of the directory where the generated manifest files will be placed +# IgnoreDirectories - Directories to ignore for SBOM generation. This will be passed through to the CG component detector. parameters: PackageVersion: 7.0.0 BuildDropPath: '$(Build.SourcesDirectory)/artifacts' PackageName: '.NET' ManifestDirPath: $(Build.ArtifactStagingDirectory)/sbom + IgnoreDirectories: '' sbomContinueOnError: true steps: @@ -34,6 +36,8 @@ steps: BuildDropPath: ${{ parameters.buildDropPath }} PackageVersion: ${{ parameters.packageVersion }} ManifestDirPath: ${{ parameters.manifestDirPath }} + ${{ if ne(parameters.IgnoreDirectories, '') }}: + AdditionalComponentDetectorArgs: '--IgnoreDirectories ${{ parameters.IgnoreDirectories }}' - task: PublishPipelineArtifact@1 displayName: Publish SBOM manifest diff --git a/eng/common/templates/steps/source-build.yml b/eng/common/templates/steps/source-build.yml index 4ec5577d28a..a97a185a367 100644 --- a/eng/common/templates/steps/source-build.yml +++ b/eng/common/templates/steps/source-build.yml @@ -63,6 +63,11 @@ steps: targetRidArgs='/p:TargetRid=${{ parameters.platform.targetRID }}' fi + runtimeOsArgs= + if [ '${{ parameters.platform.runtimeOS }}' != '' ]; then + runtimeOsArgs='/p:RuntimeOS=${{ parameters.platform.runtimeOS }}' + fi + publishArgs= if [ '${{ parameters.platform.skipPublishValidation }}' != 'true' ]; then publishArgs='--publish' @@ -80,6 +85,7 @@ steps: $internalRuntimeDownloadArgs \ $internalRestoreArgs \ $targetRidArgs \ + $runtimeOsArgs \ /p:SourceBuildNonPortable=${{ parameters.platform.nonPortable }} \ /p:ArcadeBuildFromSource=true \ /p:AssetManifestFileName=$assetManifestFileName diff --git a/eng/common/templates/variables/pool-providers.yml b/eng/common/templates/variables/pool-providers.yml new file mode 100644 index 00000000000..a7b943c2fa4 --- /dev/null +++ b/eng/common/templates/variables/pool-providers.yml @@ -0,0 +1,48 @@ +# Select a pool provider based off branch name. Anything with branch name containing 'release' must go into an -Svc pool, +# otherwise it should go into the "normal" pools. This separates out the queueing and billing of released branches. + +# Motivation: +# Once a given branch of a repository's output has been officially "shipped" once, it is then considered to be COGS +# (Cost of goods sold) and should be moved to a servicing pool provider. This allows both separation of queueing +# (allowing release builds and main PR builds to not intefere with each other) and billing (required for COGS. +# Additionally, the pool provider name itself may be subject to change when the .NET Core Engineering Services +# team needs to move resources around and create new and potentially differently-named pools. Using this template +# file from an Arcade-ified repo helps guard against both having to update one's release/* branches and renaming. + +# How to use: +# This yaml assumes your shipped product branches use the naming convention "release/..." (which many do). +# If we find alternate naming conventions in broad usage it can be added to the condition below. +# +# First, import the template in an arcade-ified repo to pick up the variables, e.g.: +# +# variables: +# - template: eng/common/templates/variables/pool-providers.yml +# +# ... then anywhere specifying the pool provider use the runtime variables, +# $(DncEngInternalBuildPool) and $ (DncEngPublicBuildPool), e.g.: +# +# pool: +# name: $(DncEngInternalBuildPool) +# demands: ImageOverride -equals windows.vs2019.amd64 + +variables: +# Coalesce the target and source branches so we know when a PR targets a release branch +# If these variables are somehow missing, fall back to main (tends to have more capacity) +- name: BranchNameForPoolSelection + value: ${{ coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main') }} + +# Any new -Svc alternative pools should have variables added here to allow for splitting work + +# Main branch pools +- ${{ if ne(contains(variables['BranchNameForPoolSelection'], 'release'), true) }}: + - name: DncEngPublicBuildPool + value: NetCore-Public + - name: DncEngInternalBuildPool + value: NetCore1ESPool-Internal + +# Release branch pools +- ${{ if contains(variables['BranchNameForPoolSelection'], 'release') }}: + - name: DncEngPublicBuildPool + value: NetCore-Svc-Public + - name: DncEngInternalBuildPool + value: NetCore1ESPool-Svc-Internal \ No newline at end of file diff --git a/eng/common/tools.sh b/eng/common/tools.sh index c110d0ed410..6586eab458e 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -417,12 +417,11 @@ function MSBuild { Write-PipelineSetVariable -name "NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS" -value "20" Write-PipelineSetVariable -name "NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS" -value "20" - export NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY=true - export NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT=6 - export NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS=1000 - Write-PipelineSetVariable -name "NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY" -value "true" - Write-PipelineSetVariable -name "NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT" -value "6" - Write-PipelineSetVariable -name "NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS" -value "1000" + # https://github.com/dotnet/arcade/issues/11369 - disable new MSBuild server feature on linux + # This feature is new and can result in build failures from connection timeout errors. + export DOTNET_CLI_DO_NOT_USE_MSBUILD_SERVER=1 + Write-PipelineSetVariable -name "DOTNET_CLI_DO_NOT_USE_MSBUILD_SERVER" -value "1" + fi local toolset_dir="${_InitializeToolset%/*}" @@ -493,6 +492,17 @@ function MSBuild-Core { RunBuildTool "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci "$@" } +function GetDarc { + darc_path="$temp_dir/darc" + version="$1" + + if [[ -n "$version" ]]; then + version="--darcversion $version" + fi + + "$eng_root/common/darc-init.sh" --toolpath "$darc_path" $version +} + ResolvePath "${BASH_SOURCE[0]}" _script_dir=`dirname "$_ResolvePath"` diff --git a/global.json b/global.json index ed1a0361528..7ce330c1f47 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ "perl": "5.32.1.1" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.22473.1", - "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.22473.1" + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.22524.5", + "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.22524.5" } } From 27c5d892b67da443eb5d24b94718f251f0a1001b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 28 Oct 2022 12:56:55 +0200 Subject: [PATCH 50/51] [release/dev17.4] fix metadata failure due to double integration of signature (#14190) * fix metadata failure due to double duplication * fix metadata failure due to double duplication Co-authored-by: Don Syme --- src/Compiler/Driver/ParseAndCheckInputs.fs | 36 +++------------------- 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/src/Compiler/Driver/ParseAndCheckInputs.fs b/src/Compiler/Driver/ParseAndCheckInputs.fs index 703e3483f10..7470ee396c0 100644 --- a/src/Compiler/Driver/ParseAndCheckInputs.fs +++ b/src/Compiler/Driver/ParseAndCheckInputs.fs @@ -1165,26 +1165,6 @@ let AddCheckResultsToTcState ccuSigForFile, tcState -let AddDummyCheckResultsToTcState - ( - tcGlobals, - amap, - qualName: QualifiedNameOfFile, - prefixPathOpt, - tcSink, - tcState: TcState, - tcStateForImplFile: TcState, - rootSig - ) = - let hadSig = true - let emptyImplFile = CreateEmptyDummyImplFile qualName rootSig - let tcEnvAtEnd = tcStateForImplFile.TcEnvFromImpls - - let ccuSigForFile, tcState = - AddCheckResultsToTcState (tcGlobals, amap, hadSig, prefixPathOpt, tcSink, tcState.tcsTcImplEnv, qualName, rootSig) tcState - - (tcEnvAtEnd, EmptyTopAttrs, Some emptyImplFile, ccuSigForFile), tcState - /// Typecheck a single file (or interactive entry into F# Interactive) let CheckOneInputAux ( @@ -1353,18 +1333,10 @@ let CheckOneInput match partialResult with | Choice1Of2 result -> return result, tcState - | Choice2Of2 (amap, _conditionalDefines, rootSig, _priorErrors, file, tcStateForImplFile, _ccuSigForFile) -> - return - AddDummyCheckResultsToTcState( - tcGlobals, - amap, - file.QualifiedName, - prefixPathOpt, - tcSink, - tcState, - tcStateForImplFile, - rootSig - ) + | Choice2Of2 (_amap, _conditionalDefines, rootSig, _priorErrors, file, tcStateForImplFile, ccuSigForFile) -> + let emptyImplFile = CreateEmptyDummyImplFile file.QualifiedName rootSig + let tcEnvAtEnd = tcStateForImplFile.TcEnvFromImpls + return (tcEnvAtEnd, EmptyTopAttrs, Some emptyImplFile, ccuSigForFile), tcState } // Within a file, equip loggers to locally filter w.r.t. scope pragmas in each input From 788f51cc6d5e99d638db74cfbf030e0e337431a8 Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Fri, 4 Nov 2022 19:22:14 -0700 Subject: [PATCH 51/51] Global.json --- global.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/global.json b/global.json index 88734b25312..c7a03b29f9e 100644 --- a/global.json +++ b/global.json @@ -1,11 +1,11 @@ { "sdk": { - "version": "7.0.100-rc.1.22431.12", + "version": "7.0.100-rc.2.22477.23", "allowPrerelease": true, "rollForward": "latestPatch" }, "tools": { - "dotnet": "7.0.100-rc.1.22431.12", + "dotnet": "7.0.100-rc.2.22477.23", "vs": { "version": "17.2", "components": [ @@ -21,4 +21,4 @@ "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.22552.1", "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.22552.1" } -} +} \ No newline at end of file